Basic instructions
8.8 Program control operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
323
Table 8- 163 CONTINUE statement
Statement;
The CONTINUE statement skips the subsequent statements of a program loop (FOR,
WHILE, REPEAT) and continues the loop with the examination of whether the condition is
met for termination. If this is not the case, the loop continues.
The CONTINUE statement executes according to the following rules:
● This statement immediately terminates execution of a loop body.
● Depending on whether the condition for repeating the loop is satisfied or not the body is
executed again or the iteration statement is exited and the statement immediately
following is executed.
● In a FOR statement, the control variable is incremented by the specified increment
immediately after a CONTINUE statement.
Use the CONTINUE statement only within a loop. In nested loops CONTINUE always refers
to the loop that includes it immediately. CONTINUE is typically used in conjunction with an IF
statement.
If the loop is to exit regardless of the termination test, use the EXIT statement.
Example: CONTINUE statement
The following example shows the use of the CONTINUE statement to avoid a division-by-0
error when calculating the percentage of a value:
FOR i := 0 TO 10 DO
IF value[i] = 0 THEN CONTINUE; END_IF;
p := part / value[i] * 100;
s := INT_TO_STRING(p);
percent := CONCAT(IN1:=s, IN2:="%");
END_FOR;