Go to the first, previous, next, last section, table of contents.

Relational Expressions

Comparisons between two types are done with the following binary operators (see caution about comparing TEXTs below):

= (Equal), # (Not Equal)
These operators can be used with any Modula-3 type:
Ordinals are equal if they have the same value
Floats are equal if the underlying implementation defines them to be
References are equal if they address the same location
Procedures are equal if they refer to the same procedure body and environment
Sets are equal if they have the same elements
Arrays are equal if they have the same length and corresponding elements are equal
Records are equal if they have the same fields and corresponding fields are equal
< (Less Than), <= (Less Than or Equal To)
Ordinal types: the usual meaning. For sets, proper subset and subset, respectively.
> (Greater Than), >= (Greater Than or Equal To)
Ordinal types: the usual meaning. For sets, proper superset and superset, respectively.
IN
For sets only, the expression (element IN set) is TRUE iff element is an element of the set set.

Note: These operators should not be used to compare TEXT values. Use Text.Equal and Text.Compare to compare two TEXTs (see section Text Interface). The compiler will allow = and # with TEXTs, but it is the addresses at which the TEXTs are stored that are compared, not the contents of the TEXTs.


Go to the first, previous, next, last section, table of contents.