WHILE statement
This section is about the WHILE statement syntax and examples.
IMPORTANT:
Input variables are not refreshed during WHILE iterations. The state change of an input variable cannot be used to describe the condition of a WHILE statement. Using an input variable in this manner might cause unexpected controller behavior.
Item | Description |
---|---|
Name | WHILE ... DO ... END_WHILE |
Meaning | Iteration structure for a group of ST statements. The "continue" condition is evaluated before every iteration. |
Syntax |
|
Example
(* ST program using WHILE statement *) (* this program uses specific "C" functions to read characters *) (* on a serial port *) str := ''; (* empty string *) nbchar := 0; WHILE ((nbchar < 16) & ComIsReady ( )) DO str := str + ComGetChar ( ); nbchar := nbchar + 1; END_WHILE;
Provide Feedback