Even up!
I'm rather odd...
Even up!
I'm rather odd...
Even up!
I'm rather odd...
Even up!
Note
As with break, continue is rarely used without a preceding if statement of some
kind. If you always wanted to continue, you wouldn’t have entered the last part of the
loop’s body. You want to use continue only in some cycles of the loop.
The Absolute Minimum
The goal of this chapter was to teach you how to control loops better with the break
and continue statements. The while, do-while, and for loops all can be
terminated early with break or continued early with continue. Key concepts
covered in this chapter included the following:
- Use break to terminate for, while, or do-while loops early.
- Use continue to force a new cycle of a loop.
- Don’t use break or continue without some sort of relational test before them.