While-Do Statement - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

7.8.5

WHILE-DO statement

Table 7- 99
WHILE statement
SCL
WHILE "condition" DO
Statement;
Statement;
...;
END_WHILE;
Table 7- 100 Parameters
Parameter
"condition"
Statement
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
● Once the value FALSE occurs, the loop is skipped and the statement following the loop is
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.
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
Description
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.
Description
Required. A logical expression that evaluates to TRUE or FALSE. (A "null" condition is
interpreted as FALSE.)
Optional. One or more statements that are executed until the condition evaluates to TRUE.
TRUE.
executed.
100BBasic instructions
7.8 Program control
213

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents