do Statement

Top  Previous  Next

Terminates the current iteration in the loop, if a specified condition occurs, and continues with the next iteration in the loop.

Syntax

do statement

while (expression)

Arguments

statementThe statement to be executed if expression is true.
expressionAn expression that could be evaluated to Boolean true or false.

Description

Evaluates expression and if it is true, executes statement; otherwise terminates the loop.

Remarks

Compared to the while statement, a do statement is executed one time before the expression is evaluated.