+ 2
Why using goto statement is not considered as a good programming practice?????
4 Answers
+ 7
Sweet Tech
Because they lead to spaghetti code( https://en.m.wikipedia.org/wiki/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. Structuredprogramming 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
you can found also a funny meme of goto on php docs:
https://www.php.net/manual/en/control-structures.goto.php
I hope I was helpful
+ 3
It leads to nasty looking code and it's just cleaner and more appropriate to use the other methods of "moving around" code that is built into the language. There are rare occasions for using a goto statement
+ 3
It is considered ARCHAIC đĄ
+ 2
Because you can't go back to where you started. If you are at line 10 and execute goto to line 50 then you can't backtrace your way to line 10. Your program go ahead from line 50.
It's Simple