TAL Reference Manual

Expressions
TAL Reference Manual526371-001
4-13
Examples of Conditional Expressions
Examples of Conditional Expressions
Following are examples of conditional expressions:
a !condition
NOT a !NOT condition
a OR b !condition OR condition
a AND b !condition AND condition
a AND NOT b OR c !condition AND NOT condition ...
Conditions
A condition is an operand in a conditional expression that represents a true or false
state. A condition can consist of one or more of the elements listed in Table 4-8
.
Table 4-8. Conditions in Conditional Expressions
Element Description Example
Relational
expression
Two conditions connected by a relational
operator. The result type is INT; a –1 if true
or a 0 if false. The example is true if A
equals B.
If a = b THEN . . .
Group
comparison
expression
Unsigned comparison of a group of
contiguous elements with another. The result
type is INT; a –1 if true or a 0 if false. The
example compares 20 words of two INT
arrays.
IF a = b FOR 20 WORDS
THEN . . .
(conditional
expression)
A conditional expression enclosed in
parentheses. The result type is INT; a 1 if
true or a 0 if false. The example is true if
both B and C are false. The system
evaluates the parenthesized condition first,
then applies the NOT operator.
IF NOT (b OR c) THEN . . .
Arithmetic
expression
An arithmetic, assignment, CASE, or IF
expression that has an INT result * . The
expression is treated as true if its value is
not 0 and false if its value is 0. The example
is true if the value of X is not 0.
IF x THEN . . .
Relational
Operator
A signed or unsigned relational operator that
tests a condition code. Condition code
settings are CCL (negative), CCE (0), or
CCG (positive). The example is true if the
condition code setting is CCL.
IF < THEN . . .
* If an arithmetic expression has a result other than INT, use a signed relational expression.