Booleans

Construction

Description

false

Boolean value false.

true

Boolean value true.

bool(<number>)

Constructs a boolean where zero becomes false whilst every other number is true.

AND

Boolean operator AND.

Syntax:

<expression> AND <expression>

For example:

true and true // true
false and false // false
true and false // false
true and null // null
false and null // false
null and null // null

OR

<expression> OR <expression>

Boolean operator OR.

For example:

true or true // true
false or false // false
true or false // true
true or null // true
false or null // null
null or null // null

NOT

Boolean operator NOT.

Syntax:

NOT <expression>

For example:

not true // false
not false // true
not null // null

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.