WHILE statement in ST

Syntax
WHILE ... DO
...
END_WHILE;

Meaning

Use the WHILE statement to specify that a group of statements (entered after DO up to END_WHILE) is to be executed repeatedly until the associated Boolean →expression (entered after WHILE) evaluates to value FALSE (or an equivalent). If the expression initially evaluates to value FALSE (or an equivalent), then the group of statements is not executed at all.

Example
FUNCTION_BLOCK ExampleWhileDocumentation
VAR
count, sum, I : INT;
END_VAR
count := 1;
sum := 0;
WHILE LT(count, 11) DO
sum := ADD(sum, count);
count := ADD(count, 1);
END_WHILE; (* The variable 'sum' equals '55'. *)
END_FUNCTION_BLOCK

No identification of infinite loops

Infinite loops are not identified and prevented by logi.CAD 3. Therefore, enter code in your application to prevent infinite loops (e.g. abort conditions by using IF-statements).