![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Flash Player 4.
while(
condition
) {
statement(s)
;}
condition
The expression that is reevaluated each time the while
action is executed.
statement(s)
The instructions to execute while the condition evaluates to true
.
Nothing.
Statement; tests an expression and runs a statement or series of statements repeatedly in a loop as long as the expression is true
.
Before the statement block is run, the condition
is tested; if the test returns true
, the statement block is run. If the condition is false
, the statement block is skipped and the first statement after the while
action's statement block is executed.
Looping is commonly used to perform an action while a counter variable is less than a specified value. At the end of each loop, the counter is incremented until the specified value is reached. At that point, the condition
is no longer true
, and the loop ends.
The while
statement performs the following series of steps. Each repetition of steps 1-4 is called an iteration of the loop. The condition
is retested at the beginning of each iteration, as in the following steps:
condition
is evaluated.condition
evaluates to true
or a value that converts to the Boolean value true
, such as a nonzero number, go to step 3.
Otherwise, the while
statement is completed and execution resumes at the next statement after the while
loop.
statement(s)
.do while
, continue
, for
, for..in
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |