Skip to content

Max Operator

See Also: Min Operator

Purpose

To return the greater of two values from an expression.

Syntax

( {value1} max {value2} )

where {value1} and {value2} may be either expressions, variables, or constants.

What It Does

When two values are connected with an encompassing expression by max, the encompassing expression evaluates as the greater of the two values.

Example

move (nBalance max 0) to nInvoiceAmount

In this example, if nBalance were greater than 0, the value of nBalance would be moved to nInvoiceAmount. Otherwise, zero would be moved to nInvoiceAmount.

Multiple max operators may be used to link more than two values into a single expression that evaluates as the maximum of all the values in the expression:

Example

move (nBalance max 0 max nLastTransaction) to nCollectAmount

In this example, the greatest value among nBalance, 0, and nLastTransaction is moved to nCollectAmount.

Notes

  • There is no symbolic substitute for the word max.

  • When min, max, and other operators are intermingled in a single expression without grouping parentheses, evaluation proceeds from left to right with each operator connecting the next expression with the result of all previous (left-lying) ones.

    (1 max 2 min 3 max 4)
    

    would evaluate as 4, while

    (1 min 2 max 3 min 4)
    

    would evaluate as 3.