4 ms·
It can be useful in deeply nested loops. One can certainly argue about the wisdom of deeply nested loops whose complexity requires a goto statement, but sometim
by ternaryoperator 13y ago
It can be useful in deeply nested loops. One can certainly argue about the wisdom of deeply nested loops whose complexity requires a goto statement, but sometimes you just need to pop out of a loop to somewhere in a higher loop and goto solves that problem effectively.
- dragontamer 13y agoFair point. IIRC, Java and C# allow "break" statements to have a label associated with them specifically for this case. C++ "break" statements are all implicit. So a goto is the only thing that can solve this problem.