3 ms·
Also, you almost never need to use goto.
by wmgries 13y ago
Also, you almost never need to use goto.
- chrismcb 13y agoThis isn't goto's fault. A return, or a "finished = true;" or a ton of other code could have had the same result. Using a goto means it is easier to find it than some other similar mistakes.
- bakhy 13y agoAll three of those patterns are something which would lead me to consider is there a more functional-style option available to rewrite the method in question. I'll take a gigantic nested if over a split-end method (multiple exit points) any day of the week ;) But of course, such things cannot be avoided completely, nor will avoiding them magically eliminate all bugs in the universe..
- DanHulton 13y agoHm, and I'm of the opposite opinion. I like methods that fail early. Gigantic if-chains are hella-hard to parse. I should go consult Code Complete again, actually...