Chapter 8. Loop the Loop
For most people, doing the same thing over and over again is very boring, so why not let the computer do that for us? Computers never get bored, so they’re great at doing repetitive tasks. In this chapter, we’ll see how to make the computer repeat things.
Computer programs often repeat the same steps over and over again. This is called looping. There are two main kinds of loops:
- Those that repeat a certain number of times—These are called counting loops.
- Those that repeat until a certain thing happens—These are called conditional loops, because they keep going as long as some condition is true.
Counting loops ...
Get Hello World! Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.