Comparison Expressions
 
 
 

Using comparison expressions you can compare values of comparable types. The result is always one of the two Boolean values, true or false.

The various forms of <compare_expr> are as follows:

<compare_operand> == <compare_operand> -- equal
<compare_operand> != <compare_operand> -- not equal 
<compare_operand> > <compare_operand> -- greater than
<compare_operand> < <compare_operand> -- less than
<compare_operand> >= <compare_operand> -- greater than or equal
<compare_operand> <= <compare_operand> -- less than or equal

where <compare_operand> can be one of:

<math_expr>
<operand>
<function_call>

EXAMPLES:

a > b
sin x == 0.0
a + b <= n - 1

Comparison operations have lower precedence than math operations.

In the above examples, the sin function call and the "+" and "-" operations are performed before the comparisons.

As with math expressions, the comparison operators work on all appropriate types.

Equal "==" and not-equal "!=" operate on all types, and the relative comparisons work between comparable types.

The allowable comparison operators are documented with the value type descriptions.