Switch
On this page

Switch()

Function in Authoring

Open a switch (scrut) chain: Switch(scrut).case(n, body)….default(body).

import { Switch } from 'typeshade/core/ir'

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

function Switch(scrut: ReadonlyNode<'i32' | 'u32'>): SwitchChain

Parameters

scrut ReadonlyNode<'i32' | 'u32'>

the integer value dispatched on.

Return value

SwitchChain

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.

See also

Source

src/core/ir/builder.ts, line 1840, at commit af54ddad5

Edit this page Report a problem