The while statement

The while statement loops while a condition is true. The while statement has the following syntax:

while (condition)

   statement    // keeps executing statement until condition is false


In the above example, the statement in the while block is executed as long as the condition is true. The condi­tion is tested at the top of the loop each time. You can use {} brackets to group more than one statement. For example:

while (condition)





Source Insight evaluates the whole condition expression, unlike C/C++ which performs partial evaluation. See: Conditional Evaluation.