HP Pascal/iX Reference Manual (31502-90022)

4-: 12
defines the ordering. For enumerated operands, the sequence in which the
constant identifiers appear in the type definition defines the ordering.
If both operands are
Boolean
, the operator = denotes
equivalence
, <=
denotes
implication
, and <> denotes
exclusive OR
. Therefore, the
predefinition of Boolean as:
TYPE Boolean = (false, true);
means that false < true.
Example
PROGRAM show_simple_relational;
VAR
b: Boolean;
BEGIN
.
.
b := 5 > 2;
b := 5 < (25.OL+1);
END.
Set Relational Operators
A
set relational
operator has set operands. The set relational operators
are =, <>, >=, <=, and IN. The operators = and <> compare two sets for
equality or inequality, respectively. The <= operator denotes the subset
operation, while >= indicates the superset operation such that Set A is a
subset of Set B, if every element of A is also a member of B. When this
is true, B is said to be the superset of A.
The IN operator determines if the left operand is a member of the set
specified by the right operand. When the right operand has the type SET
OF T, the left operand must be type compatible with T. To test the
negative of the IN operator, the following form must be used:
NOT (element IN set)
Example
PROGRAM show_set_relational; (output)
TYPE
color= (red,yellow,blue);
VAR
b: boolean;
s,t: SET OF color;
col: color;
BEGIN
col:= red;
s:= [red];
t:= [blue];
b:= s <> t;
writeln (b);
b:= s <= t;
writeln (b);
b:= col IN [yellow,blue];
writeln (b);
END.
Output:
TRUE
FALSE
FALSE
IN.
This operator returns
true
if the specified element is a member of the
specified set. The result is
false
if the expression is not a member of
the set. Both the element being tested and the elements in the set must
be of compatible types.