Switch()
Function in Authoring
Open a switch (scrut) chain: Switch(scrut).case(n, body)….default(body).
import { Switch } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
function Switch(scrut: ReadonlyNode<'i32' | 'u32'>): SwitchChainParameters
scrutReadonlyNode<'i32' | 'u32'>the integer value dispatched on.
Return value
the chain, for .case and .default.
Description
The
scrutinee is a read position, so a read-only node is accepted, and it must be i32 or
u32: WGSL and GLSL ES 3.00 both type switch over integers only.
In the guide
See also
Source
src/core/ir/builder.ts, line 2123, at commit 26de7be8