Mega Code Archive

 
Categories / Flash ActionScript / Statement
 

Use while loop to calculate 2 to the power of 3

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         var total = 2;         var counter = 0;                  while (counter < 2) {           total = total * 2;           counter = counter + 1;         }     }   } }