DO

Member Of Menu: 
Branch
Argument Types: 
None
Result Type(s): 
None
Invertible: 
No
Valid In Expression: 
No

The DO operation is used to define a loop structure within a program. It is combined with the UNTIL and END operation to define the boundaries of the loop.

The normal way DO is used is:

≪ ... DO ... operations ... UNTIL ... operations ... END ... ≫

The operations between DO and UNTIL are the loop operations and the operations between UNTIL and END are the test operations which determine whether to loop back to the beginning of the loop operations. When END is reached, the top of the stack is popped. A real value is expected. If the real value is 0 (false), then execution loops back to the operation following DO. If the real value is non-zero (true), then execution continues after END and the loop terminates.

With a DO loop, the loop operations are evaluated at least once and will continue to execute until the test operations return a true value.

An error will be raised if this operation is used outside of program execution context.