Previous Next Chapter

Comparison Operators

ARexx supports three types of comparisons:

Comparisons always result in a Boolean value. The numbers 0 and 1 are used to represent the Boolean values false and true. The use of a value other than 0 or 1 when a Boolean operand is expected will generate an error. Any number equivalent to 0 or 1, for example 0.000 or 0.1E1, is also acceptable as a Boolean value.

Except for the exact equality (==) and exact inequality (~==) operators, all comparison operators dynamically determine whether a string or numeric comparison is to be performed. A numeric comparison is performed if both operands are valid numbers. Otherwise, the operands are compared as strings.

All comparisons have a priority of 3. Table 3-3 lists the acceptable comparison operators.

Table 3-3. Comparison Operators

Operator Operation Mode

== Exact equality Exact

~== Exact Inequality Exact

= Equality String/Numeric

~= Inequality String/Numeric

> Greater Than String/Numeric

>= or ~< Greater Than or Equal To String/Numeric

< Less Than String/Numeric

<= or ~> Less Than or Equal To String/Numeric

Top Previous Next Chapter