Skip to content

Operators

Jordan Leppert edited this page Jan 9, 2025 · 7 revisions

Two-operand operators

Most operators take two operands (inputs). The syntax is:

<operand 1><operator symbol><operand 2>

Example:

123+456

Whitespace is permitted between the operands and operator. The operator symbol can be multiple characters. If it only contains letters, then there must be a non-word character immediately after the symbol. For example:

# This is fine
(true)and(true)
# This is not
(true)andtrue

One-operand operators

By default there is one operator that takes a single operand, the "not" operand.

# Outputs False
not true

More than two operand operators

By default there is one operator that takes more than two operands, the "then/else" operator, which is like the ternary (?/:) operator from various programming languages.

a = 5
a % 2 == 0 then 'even' else 'odd'

Clone this wiki locally