Repeat-Until Statement - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents
Basic instructions
7.8 Program control operations
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 273). 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.
7.8.9.6

REPEAT-UNTIL statement

Table 7- 122 REPEAT instruction
SCL
REPEAT
Statement;
;
UNTIL "condition"
END_REPEAT;
Table 7- 123 Parameters
Parameter
Statement
"condition"
Note
Before evaluating the state of "condition", the REPEAT statement executes the statements
during the first iteration of the loop (even if "condition" is FALSE). To review the state of
"condition" before executing the statements, use the WHILE statement (Page 271).
To end the loop regardless of the state of the "condition" expression, use the EXIT statement
(Page 273). The EXIT statement executes the statement immediately following the
END_REPEAT statement
Use the CONTINUE statement (Page 273) to skip the subsequent statements of a REPEAT
loop and to continue the loop with the examination of whether the condition is met for
termination.
272
Description
The REPEAT statement executes a group of statements until a given condition is
TRUE.
You can nest REPEAT loops. The END_REPEAT statement always refers to the last
executed Repeat instruction.
Description
Optional. One or more statements that are executed until the condition is TRUE.
Required. One or more expressions of the two following ways: A numeric expression or string
expression that evaluates to TRUE or FALSE. A "null" condition is interpreted as FALSE.
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
Table of Contents
loading

Table of Contents