The while loops are used to repeat a block of code as long as a specified condition is true.
The while loops have the following syntax:
while (condition) { // codeBlock }- If the condition is true, the code within curly brackets is executed, then the script checks again the condition, and if it is still true, "codeBlock" is executed again. This process continues until condition becomes false, or you use a "break" statement to end the loop.
var total:int = 1; // define a variable (counter) to control the executions number var i:int=0; // create a while loop while(i<4) { total *= 2; trace(total); i++; // adds 1 to counter (i) } // In Output displays: 2 4 8 16ActionScript first evaluates the condition (i<4), becouse "i=0", this condition returns true; so, ActionScript executes the loop body.
do { // codeBlock } while (condition);Example:
var total:int = 1; // define a variable (counter) to control the executions number var i:int=1; // create a do..while loop do { total *= 2; trace('total is '+ total); i++; // adds 1 to counter (i) } while(i<0); // In Output displays: total is 2This code displays in Output panel: total is 2
<table><tr> <th>Title 1</th> <th>Title 2</th> </tr></table>
.some_class { line-height: 150%; }
document.getElementById("id_button").onclick = function(){ window.open("http://coursesweb.net/"); }
$ar_dir = scandir("dir_name"); var_export($ar_dir);