Skip to main content

Booleans

Construction

Description
falseBoolean value false.
trueBoolean value true.
bool(<number>)Constructs a boolean where zero becomes false whilst every other number is true.

Operations

Comparisons

Equalities follow SQL null semantics, where a comparison with null returns null since the value is unknown:

true = true // true
true = null // null
true = false // false
null = null // null
true <> null // null
null <> null // null

For inequalities, a comparison with null also returns null since the value is unknown. Moreover, for inequalities, the value false is considered smaller than true.

null < false // null
false < true // true
true >= false // true

Casts

Booleans can be casted to:

  • strings, where true becomes “true” and false becomes “false”;
  • numbers, where true is 1 and false is 0.