Summary
In this chapter, we quickly got to grips with loops, including while
loops, do while
loops, and for
loops. Loops are part of Java's control flow. Finally, we used our knowledge of for
loops to draw the grid lines for the Sub' Hunter game. Also, if you were wondering why we didn't use all of the new operators, then don't worry – we will use some more of them in the next chapter.
We will see more control flow options in the next chapter, one of which (if keyword
) we just had a quick look at. This time, we will learn how to branch the execution of our code and once we have learned this, we will be able to finish the game.