PS TEXT FORMAT Reference Manual
Expressions
11387 Tandem Computers Incorporated 5-15
Logical Operators The logical operators are of two types: those that specify a comparison
between two numeric or two string operands and that yield a Boolean
result (true if the stated comparative relationship between the two
operands exists, false if it doesn’t); and those that combine two Boolean
entities to produce one Boolean value. They are shown in Table 5-8.
Table 5-8. Logical Operators
Logical Type of Type of
Operator Operation Operand Result
> Greater than Numeric or string Boolean
< Less than Numeric or string Boolean
= Equal to Numeric or string Boolean
> = Greater than or equal to Numeric or string Boolean
< = Less than or equal to Numeric or string Boolean
< > Not equal to Numeric or string Boolean
&& Boolean "and" Boolean Boolean
// Boolean inclusive "or" Boolean Boolean
Comparing Operand
Types
Operands can be of numeric, string, or Boolean type; like operands are
compared with different criteria.
TFORM bases any comparison of numeric operands on algebraic values;
for example, 5 is greater than 4 but –5 is less than –4. On the other hand,
TFORM compares string operands on the basis of the ASCII collating
sequence; “greater than” is interpreted as “later in the collating sequence”
and “less than” is “earlier in sequence.” For example, “A” <“B” is true.
You can compare strings of different lengths; TFORM looks at the shorter
string as if it were filled in with trailing null characters (ASCII code 0) to
make it the same length as the longer string.
When combining Boolean operands, the truth of the result depends on the
truth of either or both of the operands, depending on the operator used.
For example, A&&B is true if—and only if—both A and B are true; A//B is
true if either A or B (or both) is true.