TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-257
#LOOP Built-In Function
#LOOP Built-In Function
Use #LOOP to execute one or more statements iteratively within a function.
enclosure
is an enclosure that can contain either of two sets of two labels: WHILE and DO, or
DO and UNTIL.
| WHILE | numeric-expression
or
| UNTIL | numeric-expression
evaluates numeric-expression as either true or false:
| DO | [ text ]
returns text, typically a sequence of one or more functions to be repeatedly
executed while numeric-expression is true, or until numeric-
expression becomes true. If you omit text, #LOOP merely waits until the
specified criterion is met.
Result
#LOOP evaluates the WHILE or UNTIL text and tests it for inequality to zero.
Depending on the result of that test, #LOOP either returns the DO text (typically TACL
statements for execution) and repeats the test, or terminates.
Considerations
The WHILE/DO version of #LOOP evaluates the expression first; if the expression
is true, it executes the DO text. It continues to do so as long as the expression is
true. The |WHILE| label must precede the |DO| label.
The DO/UNTIL version of #LOOP executes the DO text before evaluating the
expression; if the expression is false, #LOOP performs another iteration. #LOOP
continues its iterations until the expression becomes true. This version always
makes at least one loop, even if the expression was initially true. The |DO| label
must precede the |UNTIL| label.
#LOOP enclosure
true = a nonzero value
false = zero