REPEAT...UNTIL (Statement)


Repeat a block of statements in a posttest loop.


REPEAT
:
UNTIL [<conditional expression>]


This statement repeats a block of statements between REPEAT and UNTIL until <conditional expression> becomes true.
If <conditional expression> is omitted, the condition will be assumed as true (not 0) so that this statement executes only once.
There is also a DO...LOOP UNTIL statement that is functionally equivalent to this statement, so using only the DO...LOOP UNTIL is recommended.



DEFINT li1, li2, li3, li4, li5, li6, li7, li8, li9
DO WHILE li1 > li2
'Repeat in a pretest loop
IF li1 = 4 THEN EXIT DO
'If li1=4, exit from DO...LOOP
FOR li3 = 0 TO 5
'Repeat the process of FOR...NEXT 5 times
FOR li4 = li5 TO li6
'Repeat the process of FOR...NEXT while adding 1 to the
'value of li5 each time the process is done until li5
'becomes the value of li6
FOR li7 = 1 TO li8 STEP 2
'Repeat the process of FOR...NEXT while adding 2 to the
'value starting with 1 each time the process is done
'until the value becomes li8
IF li2 = 2 THEN EXIT FOR
'If li2=2, exit from FOR...NEXT
DO WHILE li2 < li9
'Repeat in a pretest loop
GOSUB *samp2
li9 = li9 + 1
LOOP
'Call a GOSUB *samp2 statement while li2 < li9
NEXT li7
'Repeat
NEXT
'Repeat
NEXT
'Repeat
li9 = 0
REPEAT
'Repeat in a posttest loop
GOSUB *samp2
li9 = li9 + 1
UNTIL li9 < 5
'Call a GOSUB *samp2 statement until li9 < 5
LOOP
'Repeat


Top