Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In Chapter 3 you learned how to make decisions in your program and how to alter its execution based on the results of those decisions. In this chapter, you learn about another fundamental feature of computer programming languages: the capability to repeatedly execute a set of statements.
In many instances, you'll want to iterate a group of statements. For example, you may want to print each file from a list of files. Or you may want to rename each file in a certain folder. Finally, you may have iPhoto images stored in an album that you want to resize. Each of these situations requires you to apply your process—whether it's printing, renaming, or resizing—to each file, in turn. This is done through the process of iteration.