Site under construction! :3

Boolean (bool) ξ―‚

The boolean type represents a truth value. It has exactly two constant states: true or false.

The built-in function bool will convert any value to a boolean, if the value can be interpreted as a boolean.

Operatorsξ―‚

notξ―‚

The boolean not operator will be the opposite value of the boolean it receives.

Truth table

a not a
T βœ… F ❌
F ❌ T βœ…

andξ―‚

The boolean and operator will be true if and only if both inputs are true, otherwise it will be false.

Truth table

a b a and b
T βœ… T βœ… T βœ…
T βœ… F ❌ F ❌
F ❌ T βœ… F ❌
F ❌ F ❌ F ❌

Its negated form (nand) is not included in the standard library as a keyword, but it can be achieved by using chained operators: not (a and b).

Be aware of the placement of the brackets here, as not a and b is evaluated as (not a) and b.

orξ―‚

The boolean or operator will be true if and only if at least one of the inputs is true, otherwise it will be false.

Truth table

a b a or b
T βœ… T βœ… T βœ…
T βœ… F ❌ T βœ…
F ❌ T βœ… T βœ…
F ❌ F ❌ F ❌

Its negated form (nor) is not included in the standard library as a keyword, but it can be achieved by using chained operators: not (a or b).

Be aware of the placement of the brackets here, as not a or b is evaluated as (not a) or b.

xorξ―‚

The boolean xor operator will be true if and only if one, but not both of the inputs are true, otherwise it will be false.

Truth table

a b a xor b
T βœ… T βœ… F ❌
T βœ… F ❌ T βœ…
F ❌ T βœ… T βœ…
F ❌ F ❌ F ❌

Its negated form (xnor) is not included in the standard library as a keyword, but it can be achieved by using chained operators: not (a xor b).

Be aware of the placement of the brackets here, as not a xor b is evaluated as (not a) xor b.