select
constselect:DualFn<{(f,t,cond):boolean; (f,t,cond):number; <T>(f,t,cond):T; }>
Defined in: packages/typegpu/src/std/boolean.ts:424
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)© Software Mansion 2026. All trademarks and copyrights belong to their respective owners. Read about our Privacy Policy.