Relational operators evaluate the truth of a comparison between two expressions. The following table lists relational operators. Operator precedence does not apply to relational operators.
Operator | Description |
---|---|
< | Evaluates true if the preceding expression is less than the following expression. |
> | Evaluates true if the preceding expression is greater than the following expression. |
= | Evaluates true if the preceding and following expressions are equal (commutative). |
<= | Evaluates true if the preceding expression is less than or equal to the following expression. |
>= | Evaluates true if the preceding expression is greater than or equal to the following expression. |
<> | Evaluates true if the preceding and following expressions are not equal (commutative). |
IN | Evaluates true if the preceding expression is a member of the following expression (which must be a set expression). |
isA | Evaluates true if the preceding expression is an instance of the class specified by the following expression, or a subclass thereof. Refer to Example 3 below for more information on usage. |
Relational NOT
A relational NOT preceding a relational operator inverts the relational operator. It applies only to the relational operator, and is not the same as a logical NOT (~), which applies to the conditional statement itself.
Examples
Example 1
The following pair of conditional statements are equivalent:
expression1 NOT= expression2 expression1 <> expression2
Example 2
The following pair of conditional statements are equivalent:
expression1 NOT> expression2 expression1 <= expression2
Example 3
The following example iterates through a set of class records and outputs an appropriate message if the current class record is an instance of a particular class. The class A has a subclass B, which has a subclass C.
ForEach MyClass in A If MyClass isA A Message Attention "MyClass is an instance of A, B, or C" End If MyClass isA B Message Attention "MyClass is an instance of B or C" End If MyClass isA C Message Attention "MyClass is an instance of C" End End