EXIT statement

The EXIT statement is commonly used within an IF statement inside a FOR, WHILE, or REPEAT block. EXIT statements are not compliant with the IEC-61131-3 standard, and we recommend not using them.
Properties of EXIT statement
Item
Description
Name
EXIT
Meaning
Exits from a FOR, WHILE, or REPEAT statement.
Syntax
EXIT;

Example

(* ST program using EXIT statement *) (* this program searches for a character in a string *) length := mlen (message); found := NO; FOR index := 1 TO length BY 1 DO code := ascii (message, index); IF (code = searched_char) THEN found := YES; EXIT; END_IF; END_FOR;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal