9 Using Loops

If there is one thing that computers are good at (but if yours has just crashed then you might be forgiven for thinking they are good at precious little) it is doing boring repetitive jobs. In this chapter we will look at how you can tell your program to repeat and repeat and repeat. No programming language would be complete without the ability to repeat sections of code several times. Games regularly need to run a section of code several times. In this chapter we will look at creating sections of code that repeat and show you how to control the program flow in these situations. We will learn how to jump out of the code if a certain condition is met. We will consider using repeats that run at least once and repeats that may never ...

Get Flash MX 2004 Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.