EXIT

Statement - Exit from a loop instruction.

Remarks

  • The EXIT statement indicates that the current loop (FOR, REPEAT, or WHILE) must be finished.
  • The execution continues after the END_FOR, END_REPEAT, or END_WHILE keyword or the loop where the EXIT is.
  • EXIT quits only one loop and cannot be used to exit at the same time several levels of nested loops.

  • Loop instructions can lead to infinite loops that block the target cycle.

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* This program searches for the first non null item of an array: *)
iFound = -1; (* means: not found *)
FOR iPos := 0 TO (iArrayDim - 1) DO
   IF iPos <> 0 THEN
      iFound := iPos;
      EXIT;
   END_IF;
END_FOR;

See Also