Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4
Armite F4 ArmiteH7 Picomite CMM2
Syntax:
DO
DO WHILE expression
CONTINUE DO
EXIT DO
LOOP
LOOP UNTIL
Description:
DO
<statements>
LOOP
This structure will loop forever;
the EXIT DO command can be used to terminate the loop or control must be
explicitly transferred outside of the loop by commands like GOTO or EXIT SUB (if
in a subroutine).
EXIT DO is preferred over GOTO.
DO WHILE expression
<statements>
LOOP
Loops while "expression" is true (this is equivalent to the older
WHILE-WEND loop, also implemented in MMBasic).
If, at the start, the expression is false the statements in the loop will not be
executed, not even once.
DO
<statements>
LOOP UNTIL expression
Loops until the expression following UNTIL is true.
Because the test is made at the end of the loop the statements inside the loop
will be executed at least once, even if the expression is true.
CONTINUE DO
Skip to the end of a DO/LOOP. The loop condition will then be tested and if
still valid the loop will continue with the next iteration.
n = 0
DO
n= n + 1
PRINT n
LOOP UNTIL n = 5
PRINT
n = 0
DO
n = n + 1
IF n < 3 THEN CONTINUE DO ' skip the remainder of the loop if N
< 3
PRINT n
IF n >= 5 THEN EXIT DO
LOOP
Last edited: 29 September, 2020