Programs accomplish most of their work by branching and looping. In Lesson 5, “Working with Expressions, Statements, and Operators,” you learned how to branch your program using the
In this lesson, you will learn
What loops are and how they are used
How to build various loops
An alternative to deeply nested
Many programming problems are solved by repeatedly acting on the same data. Two ways to do this are recursion (discussed in Lesson 6, “Organizing Code with Functions”) and iteration. Iteration means doing the same thing again and again. The principal method of iteration is the loop.
In the primitive days of early computer science, programs ...