+ 1
goto command
[ I don't know is there a command like goto in other programming languages but when I search informations to learn c++ (from beginner) they are saying don't use goto command. ] Why shouldn't we use goto command? Is it making programmer lazy?
3 Answers
+ 12
Because they lead to spaghetti code.
In the past programming languages didn't have while() if() etc, and programmers used goto to make up the logic of their programs. It lead to an unmaintainable mess.
That's why the CS gods created functions conditionals and loops. Structured programming was a revolution at the time.
goto's are appropriate in a few places, such as for jumping out of nested loops
Source - https://stackoverflow.com/questions/3517726/what-is-wrong-with-using-goto
+ 3
https://en.m.wikipedia.org/wiki/Considered_harmful