+ 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?

15th Nov 2017, 10:14 AM
Mustafa K.
Mustafa K. - avatar
2 Antworten
+ 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
15th Nov 2017, 10:16 AM
qwerty
qwerty - avatar
+ 3
https://en.m.wikipedia.org/wiki/Considered_harmful
15th Nov 2017, 10:55 AM
Oma Falk
Oma Falk - avatar