Purpose | The do ... 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 |
do { {iteration statements} } while({loop condition}); {iteration statements} |
the statements to be executed with each iteration of the loop. |
{loop condition} |
the condition to be evaluated: if true then the loop will continue; if false then the loop will terminate. |
|
|
Example #1 |
class XEmployee { public: int MyCount = 0; }; node(XEmployee) MyEmp; do { xout("\r\nDo ... while\tinstance = " + MyEmp.MyCount); MyEmp.MyCount = MyEmp.MyCount + 1; } while(10 >= MyEmp.MyCount);
The loop starts execution with the {iteration statements} and then executes the while clause to see whether or not it should continue processing. In this case the following text is sent to the output stream: |