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 CitectSCADA can schedule other tasks.
The Sleep
() function increases the
performance of your CitectSCADA system if you use many
WHILE loops.
See Also
Working with Conditional Executors