var total:int = 1; // create a for() loop for(var i:int=0; i<4; i++) { total *= 2; if(total==8) break; // ends completely this loop trace('i='+ i+ ' - total='+ total); } // Output: i=0 - total=2 i=1 - total=4When the conditional "if(total==8)" returns true, the code after the "break" will not be executed at all, and the execution of this "for()" loop ends.
var total:int = 1; // create a for() loop for(var i:int=0; i<4; i++) { total *= 2; // skip other actions in the current iteration when total==4 or total==8 if(total==4 || total==8) continue; trace('i='+ i+ ' - total='+ total); }The Output is:
"break and "continue" can be used with any loop statement: while(), do..while, for(), for..in, for each..in.
<p>Address: <strong>http://CoursesWeb.net/</strong> - Tutorials.</p>
#id { font-weight: 800; }
function someFunction() { alert("CoursesWeb.net"); } setInterval("someFunction()", 2000);
$vname = 8; echo $vname;