Articles in the Statements Category
AS3, Statements »
The continue statement skips the rest of the code inside a loop and starts at the beginning of this loop as if the end of the loop had been reached normally.
Thus, the code after the continue statement in the code below will never get executed by flash:
for(var i:int = 0 ; i < 10 ; i++)
{
trace( "before continue" );
continue;
trace( "after continue" );
}
The “trace( “after continue” );” never gets executed.
Now, as with the break statement, you can set labels …
AS3, Statements »
The break statement allows us to skip the execution of a loop or statement:
for(var i:int = 0 ; i < 10 ; i++)
{
if ( i >= 5 )
{
break;
}
}
Simple.
Now imagine we have a loop nested in another loop:
for(var i:int = 0 ; i < 10 ; i++)
{
for(var i2:int = 0 ; i2 < 10 ; i2++)
{
if ( i2 >= 5 )
{
break;
}
}
}
The break statement here will only skip the rest of the immediate loop. The first loop will keep on going until its condition is reached.
Now we want to break both loops. …





