Is there something like break(2) (multiple break) ?
Suppose I have
The method I'd use normally would be setting some flag, then break from the x loop, and the y loop checks if the flag is set, and then breaks there as well.
for (y=0; y<100; y++)
for (x=0; x<100; x++)
break(2); // ?? I want to break out of the x AND y loop!
Or, if I don't need the resulting y, I could do "y=101; break;" in the x loop.
But is there a better way to do a "nested" break, i.e. from multiple levels?
Same for this example:
Again, I can easily make a workaround, but I'm wondering of there's a better solution.
for (i=0; i<n; i++)
x = something(i);
case 1: /* ... */ break;
case 2: /* ... */ break;
case 666: break(2); // here I want to break not only out of the switch case, but out of the i loop as well!
case 1000: /* ... */ break;