Chapter 7
RAPID!
Commands
4460 GSM System Option and 4468 EDGE System Option
Version 12.20
287
Control commands
Control commands organize the process of a program. They e.g. allow to run a
specific part of a program several times or to select between different sets of
commands, depending on a condition.
In RAPID!, the following control commands have been implemented:
DO ... LOOP, WHILE, UNTIL
Command
Short description
DO ...
LOOP
Loop with condition.
FOR ...
NEXT
Loop with a specified number of cycles.
IF ...
THEN
Checks a condition.
SELECT
CASE
Selects one of several cases.
Syntax
Syntax 1
DO [ {WHILE | UNTIL} boolExp ]
[ instructions ]
[ EXIT DO ]
[ instructions ]
LOOP
Syntax 2
DO
[ instructions ]
[ EXIT DO ]
[ instructions ]
LOOP [ {WHILE | UNTIL} boolExp ]
Parameters
boolExp
is a boolean expression,
instructions
are an (optional) number of program
lines.
Description
Dependent on a condition (
boolExp
), this command
structure repeatedly runs a program segment.
Syntax 1 checks the condition before the loop is run. If
the condition is true in the moment the program arrives
at the loop, it will not be run at all.
Syntax 2 checks the condition after the loop has been
run.
WHILE
means that the loop will be run as long as
bool-
Exp
is true.
UNTIL
will run the loop until
boolExp
becomes true.
EXIT DO
causes the loop to be left instantly.
If the optional part with the condition is left out, the
loop will be run endlessly. In this case, the only way out
is an
EXIT DO
command somewhere within the loop to
prevent the program from being trapped.