Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Using WHILE ​.​.​. DO Conditional Loops

  • Last UpdatedJul 18, 2023
  • 1 minute read

A While loop executes a statement or statements in a loop as long as a given condition is true.

WHILE Expression DO
Statement(s);
END

The following code fragment uses a WHILE loop:

INT Counter;
WHILE DevNext(hDev) DO
Counter = Counter + 1;
END
/* Count the number of records in the device (hDev)*/

Be careful when using WHILE loops in your Cicode functions: WHILE loops can cause excessive loading of the CPU and therefore reduce system performance. If you use a WHILE loop to loop forever, you should call the Cicode function Sleep() so that Plant SCADA can schedule other tasks. The Sleep() function increases the performance of your Plant SCADA system if you use many WHILE loops.

See Also

Working with Conditional Executors

TitleResults for “How to create a CRG?”Also Available in