gt()

Returns true if one value is greater than another value.

Synopsis

gt(x, y)

Description

This function 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.

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.

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)

Errors

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.

See Also

eq(), equal(), gte(), lt(), lte(), neq()