Skip to content

not

const not: DualFn<{(value): boolean; (value): boolean; <T>(value): VecInstanceToBooleanVecInstance<T>; (value): boolean; }>

Defined in: packages/typegpu/src/std/boolean.ts:216

Returns the logical negation of the given value. For scalars (bool, number), returns !value. For boolean vectors, returns component-wise !value. For numeric vectors, returns a boolean vector with component-wise truthiness negation. For all other types, returns the truthiness negation (in WGSL, this applies only if the value is known at compile-time).

not(true) // returns false
not(-1) // returns false
not(0) // returns true
not(vec3b(true, true, false)) // returns vec3b(false, false, true)
not(vec3f(1.0, 0.0, -1.0)) // returns vec3b(false, true, false)
not({a: 1882}) // returns false
not(NaN) // returns false **as in WGSL**