for (int bar =0; bar < 100; ++bar)
{
for(int foo = 0; foo < 100; ++foo)
{
if (foo * bar == 100)
{
foo = 100;
bar = 100;
continue;
}
}
}
printf("%d", 100);
So instead of a goto whose purpose is immediately obvious (you even get a label in whose name you can document what's going on), now we have code which expresses intent worse and requires changing the ranges in two places if they ever change. What if we now want to do something when the loops end without the condition ever being found? With the goto, you just put that code before the label; with the new code, there is really no obvious way of doing it. What if we are interested in knowing the values of foo and bar whose product is 100 beyond the loop? Again the old code was easier to adapt.
The only "advantage" of the second code is that it doesn't use goto, which as far as I am concerned is a ridiculous metric.