The for Statement : For : Statement Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Statement » For »

 

The for Statement


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var total = 2;
        
        for (var i = 0; i < 2; i++) {
          total = total * 2;
        }
        
        //here's the equivalent while loop:
        var total = 2;
        var i = 0;
        
        while (i < 2) {
          total = total * 2;
          i++;
        }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Statement
» For