2 ms·
If you have a complicated function, and several exit points where you want to bail out, they why not just put a "label: bail" and goto it? GOTO has a bad rap I
by euroclydon 9y ago
If you have a complicated function, and several exit points where you want to bail out, they why not just put a "label: bail" and goto it?
GOTO has a bad rap IMO. There's a place for it, and the author should probably be using it.
- macca321 9y agoYou're a brave person to say this in public. :D
- kstenerud 9y agoBecause if you don't have resource cleanup to do in the method, the GOTO boilerplate is just making things unnecessarily more complicated than a simple return.
- dragonwriter 9y ago> If you have a complicated function, and several exit points where you want to bail out, they why not just put a "label: bail" and goto it? Because go-to is so infrequently a good choice and do frequently used when wrong that most languages don't have it at all, so it's not an option. It may be a reasonable. choice when available, especially if you aren't breaking structure and thereby making it harder to follow the logic.