do while
Availability
Flash Player 4.
Usage
do {
statement(s)
} while (condition)
Parameters
The condition to evaluate.
condition
statement(s)
to
.
true
Returns
Nothing.
Description
Statement; similar to a
evaluation of the condition. Subsequently, the statements are executed only if the condition
evaluates to
true
A
loop ensures that the code inside the loop executes at least once. Although this can
do..while
also be done with a
loop begins, many programmers believe that
while
If the condition always evaluates to
loop, you encounter problems with Flash Player and eventually get a warning message or crash the
player. Whenever possible, you should use a
to loop. Although
all circumstances.
Example
The following example uses a
traces
until
myVar
var myVar:Number = 0;
do {
trace(myVar);
myVar++;
} while (myVar<5);
/* output:
0
1
2
3
4
*/
ActionScript Core Language Elements
The statement(s) to execute as long as the
loop, except that the statements are executed once before the initial
while
.
loop by placing a copy of the statements to be executed before the
while
true
loops are easy to read and debug, they cannot replace
for
do..while
is greater than 5. When
myVar
condition
do..while
, the
loop is infinite. If you enter an infinite
do..while
loop if you know the number of times you want
for
loop to evaluate whether a condition is
is greater than 5, the loop ends.
myVar
CHAPTER 5
parameter evaluates
loops are easier to read.
do..while
true,
do while
loops in
and
145
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?