Return
이 페이지에서

Return()

함수, 작성 분류

Push an explicit return value; onto the innermost scope.

import { Return } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

const Return: (value?: ReadonlyNode) => void

매개변수

value선택 사항 ReadonlyNode

반환값

void

설명

Use it for any return from inside If, Loop or Switch control flow: a native JavaScript return inside a nested body callback only exits that closure and emits nothing, so what reads as an early exit falls through. The one place a native return value works is a body’s own final, top-level return, which fn() appends for you. For the common “return early if a condition holds” shape, ReturnIf is the more readable guard-clause spelling.

예제

예제

If(winding.ne(0), () => {
Return(f32(1).sub(min_dist))
})
Return(f32(1).add(min_dist))

관련 가이드

함께 보기

소스

src/core/ir/builder.ts, 1704행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고