In Chapter 7, we saw that a conditional causes a statement block to be executed once if the value of its test expression is true. A loop, on the other hand, causes a statement block to be executed repeatedly, for as long as its test expression remains true.
Loops come in a variety of tasty flavors: while, do-while, for, and for-in. The first three types have very similar effects, but with varying syntax. The last type of loop, for-in, is a specialized kind of loop used with objects. We'll start our exploration of loops with the while statement, the easiest kind of loop to understand.