CONTINUE statement in ST

Syntax
CONTINUE;

Use the CONTINUE statement to jump over the remaining statements of the current iteration statement FORWHILE or REPEAT and to start with the next iteration of FORWHILE or REPEAT.

 

Example for FOR statment with CONTINUE and EXIT
FUNCTION_BLOCK ExampleForContinueExitDocumentation
  VAR
    count, sum, I : INT;
  END_VAR
  
  SUM := 0;
  FOR I := 1 TO 100 DO
    IF(I MOD 2 = 0) THEN    (* If I = an even number - because the remainder of the division "I / 2" is not equal to 0,  *)
      CONTINUE;             (* the remaining statements are jumped over - due to 'CONTINUE'. The next iteration of the FOR statement is started. *)
    END_IF;
    IF(I >= 10) THEN        (* If I >= 10,  *)
      EXIT;                 (* the FOR statement is terminated - due to 'EXIT'. *)
    END_IF;
    SUM := SUM + I;         (* This assignment is repeated in the FOR statement, if I='1', I='3', I='5', I='7' and I='9'. *)
  END_FOR;
END_FUNCTION_BLOCK