+ 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

23rd Mar 2018, 7:05 PM
™TheChamp921
™TheChamp921 - avatar
16 Réponses
+ 9
B-b-but... why?
23rd Mar 2018, 7:36 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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 😃
24th Mar 2018, 2:47 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 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... 🤝
24th Mar 2018, 5:09 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
@Semako I was referring to the very idea of GOTO in Python ;)
23rd Mar 2018, 8:06 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
yeeppy ! nikolay sir is back now sololearn must make them moderator 😄😄
24th Mar 2018, 5:07 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 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.
23rd Mar 2018, 7:47 PM
Semako ADOVOHEKPE
Semako ADOVOHEKPE - avatar
+ 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
24th Mar 2018, 7:50 PM
™TheChamp921
™TheChamp921 - avatar
+ 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/
23rd Mar 2018, 7:27 PM
Semako ADOVOHEKPE
Semako ADOVOHEKPE - avatar
+ 2
@Semako:- Thanks For Providing Me This Answer Cheers Buddy!! And Thanks To Others Too😊😇
24th Mar 2018, 6:59 AM
™TheChamp921
™TheChamp921 - avatar
+ 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
24th Mar 2018, 7:52 PM
™TheChamp921
™TheChamp921 - avatar
+ 2
@Prashanth Yeah They Should 😃
24th Mar 2018, 7:54 PM
™TheChamp921
™TheChamp921 - avatar
+ 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.
24th Mar 2018, 7:05 PM
FCP
FCP - avatar
0
@Kuba: Oh, ok. :-)
23rd Mar 2018, 10:43 PM
Semako ADOVOHEKPE
Semako ADOVOHEKPE - avatar
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.
24th Mar 2018, 2:58 PM
Sandra Glover
Sandra Glover - avatar
0
there should be jump option there could be.
24th Mar 2018, 4:37 PM
GhulamAhmed
GhulamAhmed - avatar
0
there should be jump option there could be.
24th Mar 2018, 4:37 PM
GhulamAhmed
GhulamAhmed - avatar