pTAL Reference Manual (H06.08+)

Expressions
HP pTAL Reference Manual523746-006
5-17
NOT, OR, and AND Operators
Topics:
NOT, OR, and AND Operators on page 5-17
Relational Operators on page 5-18
NOT, OR, and AND Operators
You use the operators NOT, OR, and AND to set the state of a single value or the
relationship between two values.
Topics:
Evaluating NOT, OR, and AND Operations on page 5-17
NOT, OR, and AND Operators and Condition Codes on page 5-18
Evaluating NOT, OR, and AND Operations
NOT, OR, and AND operations are evaluated by means of short-circuit expression
evaluation; that is:
Conditions connected by the OR operator are evaluated from left to right only until
a true condition occurs.
Conditions connected by the AND operator are evaluated from left to right until a
false condition occurs. The next condition is evaluated only if the preceding
condition is true.
In Example 5-3 on page 5-17, function f will not be called because a <> 0 is false.
Table 5-13. Results of NOT, OR, and AND Operators
Operator Operation Operand Type Result Example
NOT Negation; tests condition
for false state
STRING, INT, or
UNSIGNED(1-16)
True/False NOT a
OR Disjunction; produces
true state if either
adjacent condition is
true
STRING, INT, or
UNSIGNED(1-16)
True/False a OR b
AND Conjunction; produces
true state if both
adjacent conditions are
true
STRING, INT, or
UNSIGNED(1-16)
True/False a AND b
Example 5-3. Short-Circuit Expression Evaluation
a := 0;
IF a <> 0 AND f(x) THEN ... ;