+ 6
Why there is no Goto statement or any similar Jump statements in python. If So then what is the solution for this. Thnks😊
No Jump Statements
16 Respuestas
+ 9
B-b-but... why?
+ 30
@Kuba, 'cause people always want a GOTO. Don't now why but they do... I always recommend learning Assembly in such cases. Then you have to jump a lot from address to address 😃
+ 7
@Nikolay I remember my first programs in BASIC on Atari and later on PC - they all included GOTOs as there was no other way of making the code non-repetitive.
But things evolved in a good direction since then. I can't imagine using such structures in nowadays languages... :D
BTW, good to have you back, man. Even if for a little while... 🤝
+ 6
@Semako I was referring to the very idea of GOTO in Python ;)
+ 5
yeeppy !
nikolay sir is back
now sololearn must make them moderator 😄😄
+ 4
From what i understand, using Goto statements leads to unstructured codes, such that when you need to trace an error, you might not know which line exactly led to the error. An example is given in the stackoverflow link i provide above.
+ 3
What!! Oh My God!!😱😱 The Legendary #Nikolay Nachev Sir Is Here On My Post Can't Believe It
Thank You Sir For Your Time And Your Valuable Comment😊😊
It's Good To See You Back Here.
Always Smile.#TheChamp
+ 2
There is a very instructive answer by user764357 here:
https://stackoverflow.com/questions/18863309/the-equivalent-of-a-goto-in-JUMP_LINK__&&__python__&&__JUMP_LINK
Another person also pointed to the existence of a goto module in Python, but making use of it is not considered good programming : http://entrian.com/goto/
+ 2
@Semako:- Thanks For Providing Me This Answer Cheers Buddy!!
And Thanks To Others Too😊😇
+ 2
@sandra I was onto building an calculator prgm. so I need to you know repeat it again and again if the user's choice is yes
+ 2
@Prashanth Yeah They Should 😃
+ 1
GOTO is replaced by functions and methods (for classes) in Python. These two keep your code much cleaner than GOTO could ever do. Also, with a little imagination, you can think of break and continue as a form of GOTO within conditional statements.
0
@Kuba: Oh, ok. :-)
0
I think you're looking for recursion. At least if you're having a problem like I did with, I think it was Ruby. Maybe giving an example of what exactly you want the GOTO for would be helpful.
0
there should be jump option there could be.
0
there should be jump option there could be.