Do-until, Do-until -4, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 88: Syntax

Publication 1746-RM001A-US-P
7-4 Control Functions
>1
REM EXAMPLE PROGRAM
>10 A=0 : C=0
>20 DO
>30 A=A+1
>40 DO
>45 C=C+1
>50 PRINT A,C,A*C
>60 WHILE C<>3
>70 C=0
>80 WHILE A<4
>90 END
READY
>RUN
1
1
1
1
2
2
1
3
3
2
1
2
2
2
4
2
3
6
3
1
3
3
2
6
3
3
9
READY
>
DO-UNTIL
Purpose
Use the DO-UNTIL statement to set up loop control within a module program.
All statements between the DO and the UNTIL[rel expr] are executed until the
relational expression following the UNTIL statement is TRUE. You can nest
DO-UNTIL loops.
The control stack (C-stack) stores all information associated with loop control
(example: DO-WHILE, DO-UNTIL, FOR-NEXT and BASIC subroutines). The
control stack is 157 bytes long. DO-WHILE and DO-UNTIL loops and GOSUB
commands use 3 bytes of the control stack. FOR-NEXT loops use 17 bytes.
Syntax
DO-UNTIL [rel expr]
IMPORTANT
Excessive nesting exceeds the limits of the control stack,
generating an error, and causing the module to enter Command
mode.