Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual
Page 86
Lexical Elements of the DEC Text Processing Utility Language
4.9 Reserved Words
4.9.4.10 Assignment Statement
The assignment statement assigns a value to a variable. In so doing, it associates
the variable with the appropriate data type.
Syntax
identifier := expression;
The assignment operator is a combination of two characters: a colon and an
equal sign (:=). Do not confuse this operator with the equal sign (=), which is a
relational operator that checks for equality.
DECTPU does not do any type checking on the data type being stored. Any data
type may be stored in any variable. For example:
X := "abc";
This assignment statement stores the string
"
abc
"
in variable X.
4.9.4.11 Repetitive Statement
The LOOP/ENDLOOP statements specify the repetitive execution of a statement
or statements until the condition specified by EXITIF is met.
Syntax
LOOP statement_1; statement_2; . . . EXITIF expression; statement_n;
ENDLOOP;
The EXITIF statement is the mechanism for exiting from a loop. You can place
the EXITIF statement anywhere inside a LOOP/ENDLOOP combination. You
can also use the EXITIF statement as many times as you like. When the EXITIF
statement is true, it causes a branch to the statement following the ENDLOOP
statement.
Syntax
EXITIF expression;
The expression is optional; without it, EXITIF always exits from the loop.
Any DECTPU language statement except an ON_ERROR statement can appear
inside a LOOP/ENDLOOP combination. For example:
LOOP
EXITIF CURRENT_OFFSET = 0;
temp_string := CURRENT_CHARACTER;
EXITIF (temp_string <> " ") AND
(temp_string <> ASCII(9));
MOVE_HORIZONTAL (-1);
temp_length := temp_length + 1;
ENDLOOP;
This procedure uses the EXITIF statement twice. Each expression following an
EXITIF statement defines a condition that causes an exit from the loop. The
statements in the loop are repeated until one of the EXITIF conditions is met.
4.9.4.12 Conditional Statement
The IF/THEN statement causes the execution of a statement or group of
statements, depending on the value of a Boolean expression. If the expression
is true, the statement is executed; otherwise, program control passes to the
statement following the IF/THEN statement.
The optional ELSE clause provides an alternative group of statements for
execution. The ELSE clause is executed if the test condition specified by IF/THEN
is false.
4–20 Lexical Elements of the DEC Text Processing Utility Language