Skip to content

gte

Syntax

gte(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 or equal to 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 or equal to 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 + gte(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 or equal to 18 are filtered into the state Select with the following transition rule.

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

This is equivalent to the following infix form.

if (age >= 18) then next(Select)

See Also