Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Building Loops and Decision Structures
◄Programming Tasks► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Statements Used in Building Loops and Decision Structures
Task Statement Action
════════════════ ════════════════ ═════════════════════════════════════
Looping FOR...NEXT Repeats statements between FOR and
NEXT a specified number of times.
EXIT FOR Provides an alternative way to exit a
FOR...NEXT loop.
DO...LOOP Repeats statements between DO and
LOOP, either until a given
condition is true (DO...LOOP UNTIL
condition), or while a given
condition is true (DO...LOOP WHILE
condition).
EXIT DO Provides an alternative way to exit a
DO...LOOP loop.
WHILE...WEND Repeats statements between WHILE and
WEND while a given condition is true
(similar to DO WHILE condition...LOOP).
Making decisions IF...THEN...ELSE Conditionally executes or branches to
different statements
SELECT CASE Conditionally executes different
statements.
Terminating a END Stops a BASIC program, procedure or
program or block.
procedure
STOP Terminates a program.
SYSTEM Closes all open files and returns
control to the operating system.
Branching to ON...GOSUB Branches to one of several specified
lines ON...GOTO lines, depending on the value of an
expression.