Personally, I never had to use goto, and, for example, Øyvind Bråthen and Numenor stated that the loop method is the best way to accomplish this task.
However, there is one case where I can think of where goto would be useful
How a switch "fails" in C # is illegal (causes a compiler error):
switch (a) { case 3: b = 7; case 4: c = 3; break; default: b = 2; c = 4; break; }
To make it work, you can use goto:
switch (a) { case 3: b = 7; goto case 4; case 4: c = 3; break; default: b = 2; c = 4; break; }
jimplode
source share