100BBasic instructions
7.8 Program control
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
213
7.8.5
WHILE-DO statement
Table 7- 99 WHILE statement
SCL
Description
WHILE "condition" DO
Statement;
Statement;
...;
END_WHILE;
The WHILE statement performs a series of statements until a given condition is
TRUE.
You can nest WHILE loops. The END_WHILE statement refers to the last executed
WHILE instruction.
Table 7- 100 Parameters
Parameter
Description
"condition"
Required. A logical expression that evaluates to TRUE or FALSE. (A "null" condition is
interpreted as FALSE.)
Statement
Optional. One or more statements that are executed until the condition evaluates to TRUE.
Note
The WHILE statement evaluates the state of "condition" before executing any of the
statements. To execute the statements at least one time regardless of the state of
"condition", use the REPEAT statement.
The WHILE statement executes according to the following rules:
●
Prior to each iteration of the loop body, the execution condition is evaluated.
●
The loop body following DO iterates as long as the execution condition has the value
TRUE.
●
Once the value FALSE occurs, the loop is skipped and the statement following the loop is
executed.
To end the loop regardless of the state of the "condition" expression, use the EXIT statement
(Page 215). The EXIT statement executes the statement immediately following the
END_WHILE statement
Use the CONTINUE statement to skip the subsequent statements of a WHILE loop and to
continue the loop with the examination of whether the condition is met for termination.