Booleans
true and false are their own type: what a comparison yields, what if and while take, and a value you can store, pass and return. Run a cell to see its output beside the expected one.
A comparison is a Bool
It prints as true or false, in every engine. It is not the number 1: there is no arithmetic on it.
Store one in a variable
A flag is a Bool: a comparison gives one, and and, or and not combine them.
while not done
not flips a boolean, so while not done keeps looping until done becomes true.
Functions can return one
Bool is an annotation like Num and Arr. A predicate is an ordinary function.
Bools compare with == and !=
Two Bools can be compared with == and !=, and combined with and, or and not; no other operator accepts them.
assert_true takes one
A test can check a condition directly.
and and or stop early
The right side of and runs only when the left side is true, and the right side of or only when the left side is false, so a bounds test can guard the index beside it.
Comparing arrays gives a mask
A comparison with an array on either side is elementwise and gives 1.0 where the comparison is true and 0.0 where it is false. all and any turn a mask into one Bool, and where picks from two values with it.