continue statement

continue

Jumps past all remaining statements in the innermost loop and starts the next iteration of the loop as if control had passed through to the end of the loop normally. It has no effect outside a loop.

Availability: ActionScript 1.0; Flash Player 4

Example

In the following while loop, continue causes the Flash interpreter to skip the rest of the loop body and jump to the top of the loop, where the condition is tested:

trace("example 1"); 
var i:Number = 0; 
while (i < 10) { 
 if (i % 3 == 0) { 
 i++; 
 continue; 
 } 
 trace(i); 
 i++; 
}

In the following do..while loop, continue causes the Flash interpreter to skip the rest of the loop body and jump to the bottom of the loop, where the condition is tested:

trace("example 2"); 
var i:Number = 0; 
do { 
 if (i % 3 == 0) { 
 i++; 
 continue; 
 } 
 trace(i); 
 i++; 
} 
while (i < 10); 

In a for loop, continue causes the Flash interpreter to skip the rest of the loop body. In the following example, if the i modulo 3 equals 0, then the trace(i) statement is skipped:

trace("example 3"); 
for (var i = 0; i < 10; i++) { 
 if (i % 3 == 0) { 
 continue; 
 } 
 trace(i); 
}

In the following for..in loop, continue causes the Flash interpreter to skip the rest of the loop body and jump back to the top of the loop, where the next value in the enumeration is processed:

for (i in _root) { 
 if (i == "$version") { 
 continue; 
 } 
 trace(i); 
}

See also

do..while statement


Flash CS3