lte()

The predicate “less than or equal to” function.

Synopsis

lte(x1, x2)

Description

Numeric comparison function equivalent to the infix form 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.

Examples

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

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

or with the 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:

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

See Also

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