Skip to main content

Mathematical Operations

The simulator comes with the following built in operations:

Operation Example

Description

Type of Operation

-x

Negates x, e.g. 5 becomes -5

Negation (Numeric)

x ^ y

Becomes x raised to y

Exponentiation

x * y

Becomes x times y

Multiplication

x / y

Becomes x divided by y

Division

x % y

Becomes the remainder after x divided by y

Modulo

x + y

Becomes x plus y

Addition

x - y

Becomes x minus y

Subtraction

x <= y

True if x is less than or equal to y, otherwise false

Numeric Comparison (Boolean result)

x < y

True if x is less than y, otherwise false

Numeric Comparison (Boolean result)

x >= y

True if x is greater than or equal to y, otherwise false

Numeric Comparison (Boolean result)

x > y

True if x is greater than y, otherwise false

Numeric Comparison (Boolean result)

x != y

True if x is not equal to y, otherwise false

Comparison (Boolean result)

x = y, x == y

True if x is equal to y, otherwise false

Comparison (Boolean result)

!x

Makes false become true and true become false

Negation (Boolean)

x and y

True if both x and y are true, otherwise false

Comparison (Boolean result)

x or y

False if both x and y are false, otherwise true

Comparison (Boolean result)

if x then y else z

Becomes y if x is true, otherwise z

Logical Conditional

x ? y : z

Becomes y if x is true, otherwise z

Logical Conditional

By default, operations are evaluated in the order of the table. If you want to override this order, use parentheses to explicitly define how the expression is evaluated.