• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Working with Data: Using Statements > Repeating Actions Using Loops

Repeating Actions Using Loops

The loop statements, while, do-while, for, and for-in, are used to perform repetitive actions. Each repeatedly evaluates a condition and uses the result of the evaluation to decide whether to continue looping through the body. For example, a loop could be used to repetitively check whether a certain amount of time has elapsed, or to repetitively duplicate a movie clip until a certain number of clips have been created.

The four loop statements are closely related. The while and for statements are basically two ways of doing the same thing: Which you use is often a matter of taste. The Flash compiler translates both into while loops in the SWF. And do-while is just a minor variation of while.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint