The WHILE operation is used to define a loop structure within a program. It is combined with the REPEAT and END operation to define the boundaries of the loop.
The normal way WHILE is used is:
≪ ... WHILE ... operations ... REPEAT ... operations ... END ... ≫
The operations between WHILE and REPEAT are the test operations which determine whether to execute the loop operations and the operations between REPEAT and END are the loop operations. When REPEAT is reached, the top of the stack is popped. A real value is expected. If the real value is non-zero (true), then execution continues after the REPEAT operation, executing the loop operations and then once those operations are executed, execution loops back to the operation following WHILE. At that point, the test operations are re-evaulated. If the real value is zero (false), then execution continues after END and the loop terminates.
With a WHILE loop, the loop operations may not ever be executed. If the real value from the test operations is zero, then the loop operations are skipped and execution continues after END.
An error will be raised if this operation is used outside of program execution context.