Loops

The format for a while loop is: while ( Boolean expression) statement or block of statements;
Example: Start a new flash movie and write the code shown below in the Actions panel.

var  num:int=0;
  while(num<=5)  {
    trace(num);
    num=num+1;
  }  //loop 

When you test the movie you will see the numbers 0 to 5 in the output window.
Notice the indentation: all statement within { and } are indented the same amount for readability.

NEXT: Endless Loops