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.

if (gt(age, 18)) then next(Select)

This is equivalent to the following infix form.

if (age > 18) then next(Select)

See Also