CONTINUE¶
The CONTINUE statement goes on with the next iteration of the innermost
enclosing loop.
Note
This feature requires IEC 61131-3 Edition 3. Use
--dialect iec61131-3-ed3 to enable it. See
Enabling Dialects and Features for details.
CONTINUE can also be enabled without full Edition 3.
Pass the --allow-continue flag to enable it, or select a dialect that includes it. See
Enabling Dialects and Features for the dialects and flags
reference.
IEC 61131-3 |
Edition 3 |
Support |
Supported |
Syntax¶
CONTINUE ;
Description¶
CONTINUE skips the rest of the body of the innermost FOR, WHILE,
or REPEAT loop. The loop then goes on as it does at the end of its body:
FORadds the step to the control variable and tests the end value;WHILEtests its condition;REPEATtests itsUNTILcondition.
If CONTINUE appears inside nested loops, only the innermost loop goes
on with its next iteration. CONTINUE outside a loop is an error
(P4065).
Example¶
PROGRAM main
VAR
i : INT;
odd_sum : INT := 0;
END_VAR
FOR i := 1 TO 10 DO
IF i MOD 2 = 0 THEN
CONTINUE;
END_IF;
odd_sum := odd_sum + i;
END_FOR;
END_PROGRAM