Comment Re:Oracle matters less thank you'd think (Score 2) 157
for (
if (
goto finish;
}
}
// perform action when not found
...
finish:
// continue
With Java, this has to be done with an extra boolean to keep track (and it's much uglier).
bool found = false;
for (
if (
found = true;
break;
}
}
if (!found) {
}
Don't mistake this for saying something positive about goto though. Python one-ups both of them (and I wish this gets adopted in more languages).
for x in xrange(10):
if x == 12:
break
else:
print '12 wasn't found between 0 and 9, weird'
Much better. Conveys your intentions much more clearly than the other two. This, and the inclusion of labeled break/continue's (as seen in D) would completely replace any need for goto.