Quick start manual

Syntactic elements
4-11
Expressions
Set operators
The following operators take sets as operands.
The following rules apply to +, , and *.
•An ordinal O is in X + Y if and only if O is in X or Y (or both). O is in X Y if and
only if O is in X but not in Y. O is in X * Y if and only if O is in both X and Y.
The result of a +, , or * operation is of the type set of A..B, where A is the smallest
ordinal value in the result set and B is the largest.
The following rules apply to <=, >=, =, <>, and in.
X <= Y is True just in case every member of X is a member of Y; Z >= W is
equivalent to W <= Z. U = V is True just in case U and V contain exactly the same
members; otherwise, U <> V is True.
For an ordinal O and a set S, O in S is True just in case O is a member of S.
Relational operators
Relational operators are used to compare two operands. The operators =, <>, <=, and
>= also apply to sets (see “Set operators” on page 4-11); = and <> also apply to
pointers (see “Pointer operators” on page 4-10).
Table 4.10 Set operators
Operator Operation Operand types Result type Example
+ union set set Set1 + Set2
difference set set S - T
* intersection set set S * T
<= subset set Boolean Q <= MySet
>= superset set Boolean S1 >= S2
= equality set Boolean S2 = MySet
<> inequality set Boolean MySet <> S1
in membership ordinal, set Boolean A in Set1
Table 4.11 Relational operators
Operator Operation Operand types
Result
type
Example
= equality simple, class, class reference, interface, string,
packed string
Boolean I = Max
<> inequality simple, class, class reference, interface, string,
packed string
Boolean X <> Y
< less-than simple, string, packed string, PChar Boolean X < Y
> greater-than simple, string, packed string, PChar Boolean Len > 0
<= less-than-or-
equal-to
simple, string, packed string, PChar Boolean Cnt <= I
>= greater-than-
or-equal-to
simple, string, packed string, PChar Boolean I >= 1