3 ms·
Another good use of goto is to implement state machines --- "goto state_x" is clearer and simpler than the loop-switch that people often use. I can certainly s
by userbinator 5y ago
Another good use of goto is to implement state machines --- "goto state_x" is clearer and simpler than the loop-switch that people often use.
I can certainly say that over the years I've encountered code which was more difficult to understand and less efficient because either the author didn't want to use goto, or the language didn't have it. While it's true that you can always rewrite code to remove goto statements, it can definitely have a negative effect.
- beej71 5y agoOh, that's an interesting use I hadn't considered!