How can I break out of two nested for loops in Objective-C?

If using goto simplifies the code, then it would be appropriate.

for (;;) 
{
    for (;;) 
    {
        break; /* breaks inner loop */
    } 
    for (;;) 
    {
        goto outer; /* breaks outer loop */
    }
} 
outer:;

Leave a Comment