I have a loop like this:
label: for(X *y in z)
{
switch(y.num)
{
case ShouldDoSomething:
[self somethingWithX:y];
break;
case ShouldStopNow:
y = [self valWhenStopped];
break label;
}
[val append y];
}
Of course, since Objective-C does not support loop labeling (at least, when I try, it throws a compile error saying Expected ';' after break statement
), this doesn't work. Is there a way I can break a loop using a switch case in Objective-C? If not, what's a best practice with the same effect?