- Compound Operator
- Expression Operator
- Return Operator
- Conditional Operator if-else
- Ternary Operator ?:
- Switch Operator
- Loop Operator while
- Loop Operator for
- Loop Operator do while
- Break Operator
- Continue Operator
- Object Create Operator new
- Object Delete Operator delete
Loop Operator do while
The for and while loops check the termination at the beginning, not at the end of a loop. The third loop operator do - while checks the condition of termination at the end, after each loop iteration. The loop body is always executed at least once.
do
|
First the operator is executed, then the expression is calculated. If it is true, then the operator is executed again, and so on. If the expression becomes false, the loop terminates.
Note
If it is expected that a large number of iterations will be handled in a loop, it is advisable that you check the fact of forced program termination using the IsStopped() function.
Example:
//--- Calculate the Fibonacci series
|
See also
Initialization of Variables, Visibility Scope and Lifetime of Variables, Creating and Deleting Objects