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 are as follows:

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

where can be one of:



a > b

sin x == 0.0

a + b <= n - 1

Comparison operations have lower precedence than math operations. In the previous 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.