EnglishРусский  

Ads

Installer and installation software
Commercial and Freeware installers.

while and do statements

while

The while statement is a simple loop. The while statement has the following parts: a while keyword, a conditional expression and a loop body (block). The execution of the loop body is repeated until the value of the expression evaluates to FALSE. The loop is never executed, if the value is zero when the test is performed for the first time.

a = 0
while a < 5
{
   с += a
   a++
}

do-while

The do-while statement contains the do keyword, a loop body, the while keyword and a conditional expression. The execution of the loop body is also repeated until the value of the expression evaluates to FALSE. Unlike the while statement, the test is performed after the execution of the loop body is completed and the iteration occurs at least once.

a = 4
do
{
   ...
   a--
} while a

There are special operators for the loop terminating when it is required. See more details on the return, break, continue instructions page.

Related links