The goto Statement
Executing a goto statement causes a direct branch to be made to a specified point in the program. To identify where in the program the branch is to be made, a label is needed. A label is a name formed with the same rules as variable names; it must be immediately followed by a colon. The label is placed directly before the statement to which the branch is to be made and must appear in the same function or method as the goto.
For example, the statement
goto out_of_data;
causes the program to branch immediately to the statement that is preceded by the label out_of_data;. This label can be located anywhere in the function or method, before or after the goto, and might be used as shown here:
out_of_data: NSLog (@"Unexpected end ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access