select
Returns t if cond is true, and f otherwise.
Component-wise if cond is a vector.
Example
Section titled “Example”select(1, 2, false) // returns 1select(1, 2, true) // returns 2select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)Call Signature
Section titled “Call Signature”select(
f,t,cond):boolean
Parameters
Section titled “Parameters”boolean
boolean
boolean
Returns
Section titled “Returns”boolean
Defined in
Section titled “Defined in”packages/typegpu/src/std/boolean.ts:335
Call Signature
Section titled “Call Signature”select(
f,t,cond):number
Parameters
Section titled “Parameters”number
number
boolean
Returns
Section titled “Returns”number
Defined in
Section titled “Defined in”packages/typegpu/src/std/boolean.ts:335
Call Signature
Section titled “Call Signature”select<
T>(f,t,cond):T
Type Parameters
Section titled “Type Parameters”• T extends AnyVecInstance
Parameters
Section titled “Parameters”T
T
boolean | T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b
Returns
Section titled “Returns”T