Purpose | The while statement is used to loop repeatedly while a condition is true. At each iteration of the loop some Superx++ statements can be executed. | |||||
Format |
while({loop condition}) { {iteration statements} }; {loop condition} |
the condition to be evaluated: if true then the loop will continue; if false then the loop will terminate. |
{iteration statements} |
the statements to be executed with each iteration of the loop. |
|
|
Example #1 |
class XEmployee { public: int MyCount = 0; }; node(XEmployee) MyEmp; while(10 <= MyEmp.MyCount) { xout("\r\nWhile\tinstance = " + MyEmp.MyCount); MyEmp.MyCount = MyEmp.MyCount + 1; };
The loop starts execution and executes the <cond> clause to see whether or not it should continue processing. After that it executes the {iteration statements}. In this case the following text is sent to the output stream: |