Section 5.8 break and continue Statements
• The break
statement, when executed in a while
, for
, do
...while
or switch
, causes immediate exit from that statement.
• The continue
statement (p. 174), when executed in a while
, for
or do
...while
, skips the loop’s remaining body statements and proceeds with its next iteration. In while
and do
...while
statements, the program evaluates the loop-continuation test immediately. In a for
statement, the increment expression executes, then the program evaluates the loop-continuation test.
Get Java™ How To Program (Early Objects), Tenth 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.