Skip to content

gt

Syntax

gt(x, y)

Parameters

x
An expression that evaluates to a number.
y
An expression that evaluates to a number.

Returns

Returns 1 (true) if the x is greater than y and 0 (false) otherwise.

Description

This action is the prefix notation for the expression x > y, returning 1 (true) if the first value is greater than the second and 0 (false) otherwise.

To use a numeric comparison operator within an expression, you must use the functional version of the operator. For example:

a = a + gt(age(), 10)  # This is valid, and adds 1 to a if age > 10.
a = a + (age() > 10)   # This is not valid, and will result in a compiler error.

Examples

Agents with an age greater than 18 are filtered into the state Select with the following transition rule.

next_if(Select, gt(age(), 18))

This is equivalent to the following infix form.

next_if(Select, age() > 18)

See Also