This article discusses some common usage scenarios of the goto keyword and shows alternative approaches.
 |
| comic by xkcd.com ^ |
If someone would have asked me a few years ago when to use the goto keyword I would have answered (in capital letters): NEVER!! GOTO’S ARE EVIL! (and obviously you get attacked by raptors if you use them)
Like many I have been educated to have a emotional reaction when someone mentions the goto keyword. Emotions have nothing to do with good practices, so lets take a pragmatic look on some of the common usages of goto and see what the real value of the goto keyword is.