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