Skip to content

lte

Syntax

lte(x1, x2)

Parameters

x1
The left-hand argument, a numeric-expression.
x2
The right-hand argument, a numeric-expression.

Returns

Returns 1 if x1 is less than or equal to x2, and 0 otherwise.

Description

Numeric comparison action equivalent to the infix form x1 <= x2.

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

x = x + lte(age(), 10)  # adds 1 to x if age <= 10
x = x + (age() <= 10)  # will result in a fred_compiler error message.

Examples

Agents with an age less than or equal to 18 can be filtered into the state Select with the transition rule:

next_if(Select, lte(age(), 18))

or with the infix form:

next_if(Select, age()<=18)

See Also