Is GOTO really as evil as we are led to believe?

Posted by RoboShop on Stack Overflow See other posts from Stack Overflow or by RoboShop
Published on 2010-06-17T07:39:12Z Indexed on 2010/06/17 7:43 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

I'm a young programmer, so all my working life I've been told GOTO is evil, don't use it, if you do, your first born son will die.

Recently, I've realized that GOTO actually still exists in .NET and I was wondering, is GOTO really as bad as they say, or is it just because everyone says you shouldn't use it, so that's why you don't.

I know GOTO can be used badly, but are there any legit situations where you may possibly use it.

The only thing I can think of is maybe to use GOTO to break out of a bunch of nested loops. I reckon that might be better then having to "break" out of each of them but because GOTO is supposedly always bad, I would never use it and it would probably never pass a peer review.

What are your views? Is GOTO always bad? Can it sometimes be good? Has anyone here actually been gutsy enough to use GOTO for a real life system?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about coding-style