pTAL Reference Manual (H06.03+)

Statements
HP pTAL Reference Manual523746-005
12-26
IF
IF
The IF statement conditionally selects one of two statements to execute.
condition
is either:
A conditional expression whose value has 16 bits
An INT, INT(32), or FIXED arithmetic expression. If the result of the arithmetic
expression is not 0, condition is true. If the result is 0, condition is false.
statement-1
specifies the statement to execute if condition is true. statement-1 can be
any statement described in this section. If you omit statement-1, no action
occurs for the THEN clause.
statement-2
specifies the statement to execute if condition is false. statement-2 can be
any statement described in this section.
If the condition is true, statement-1 executes. If the condition is false,
statement-2 executes. If no ELSE clause is present, the statement following the IF
statement executes.
Example 12-25 on page 12-26 compares two arrays.
Example 12-25. IF Statement
INT .new_array[0:9];
INT .old_array[0:9];
INT item_ok;
IF new_array = old_array FOR 10 WORDS THEN
item_ok := 1
ELSE
item_ok := 0;
IF condition THEN
statement-1
statement-2
ELSE
VST050.vsd