The
goto keyword is supported
in C++, since it exists in C. Using goto is often dismissed as poor
programming style, and most of the time it is. Anytime you use goto, look
at your code and see if there’s another way to do it. On rare occasions,
you may discover goto can solve a problem that can’t be solved
otherwise, but still, consider it carefully. Here’s an example that might
make a plausible candidate:
The alternative would be to set a Boolean
that is tested in the outer for loop, and then do a break from the
inner for loop. However, if you have several levels of for or
while this could get awkward.