The continue Statement

The continue statement is similar to the break statement, except that it doesn’t cause the loop to terminate. At the point that the continue statement is executed, any statements that appear after the continue statement up to the end of the loop are skipped. Execution of the loop otherwise continues as normal.

The continue statement is most often used to bypass a group of statements inside a loop based on some condition, but then to otherwise continue executing the loop. The format of the continue statement is as follows:

continue;

Don’t use the break or continue statements until you become very familiar with writing program loops and gracefully exiting from them. These statements are too easy to abuse and can result in ...

Get Programming in Objective-C, Sixth 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.