Chapter 7

Loop Statements: How Your Programs Repeat Things

One thing computers enjoy doing more than anything else is repeating themselves. Imagine your teacher asked you to write “I love Game of Thrones!” a hundred times. Although you may love the show, you would find this a cruel punishment. Computers on the other hand, don’t mind this. In fact, a computer could easily write this a thousand times in milliseconds.

You need to understand conditional statements to properly understand the concepts of loops, the if statement in particular.

In this chapter you will learn the three loop statements in Java.