mgnslndh/NCicode — Issue #6: WHILE ... DO Conditional Loops
Author: mgnslndh
Created: 2011-11-22 19:16:47+00:00
State: open

>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 Citect-
>SCADA can schedule other tasks. The Sleep() function increases the performance of your
>CitectSCADA system if you use many WHILE loops.