If you really want to do this, then bite the bullet and use goto
.
for (int it=0; it<5; it++) {
for (int it2=0; it2<5; it2++) {
if (it2==2)
goto end_outer_loop;
NSLog(@"it=%d it2=%d", it, it2);
}
}
end_outer_loop:
// more stuff here.
This is a legitimate goto
(most gotos in the downward direction are). In fact break
is a special kind of "approved" goto, and because C is a minimal language you have to use an explicit goto in complex cases.
However as many people here have pointed out, it's better if you can use return.
You should not contort your program just to avoid goto, but in most cases it is a clue that your function is become too complex and should therefore be broken up.