A Boolean value used by conditions and short-circuit expressions.
Signature
Bool stores a Rust bool and has exactly two values: true and false. if and while require Bool; numeric zero and empty collections do not act as false. and and or evaluate their right side only when needed.
Examples
Combine conditions
The right side of and is skipped when ready is false.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
false true
Rust definition
Value::Bool(bool); conditions never coerce numbers or strings.
View Rust documentation →Support: runtime