Contents

Contact

Boolean operators

The boolean operators do what you expect with boolean values. For values that are not boolean, everything evaluates to true, except nil, 0, "" (an empty string) and [] (an empty list), which evaluate to false.

The boolean operators are:

& boolean and, evaluates to true if both operands are true
| boolean or, evaluates to true if one of the operands is true
! boolean not, evaluates to true if its operand is false

Note

The logical operators only evaluate their operands when needed: & doesn't evaluate the second operand when the first one is false, | doesn't evaluate the second operand when the first one is true.