0

Can I use goto statement in python. If not then is there any equivalent for it in python?

2nd Dec 2016, 9:47 AM
Dharm Vashisth
Dharm Vashisth - avatar
3 Antworten
+ 3
Python doesn't have a goto because it "doesn't want to have more than one way of doing things" (which also explains why it doesn't have switch/ case). You don't need a goto (goto is deemed as a bad habit). You just have to restructure the program's flow.
2nd Dec 2016, 10:21 AM
Samuel Neo
Samuel Neo - avatar
+ 1
you can use recursive function
2nd Dec 2016, 10:38 AM
Sandeep Chatterjee
0
Earlier versions had a goto though: from goto import goto, label while True: if C: goto .SampleLabelName label .SampleLabelName
2nd Dec 2016, 10:23 AM
Samuel Neo
Samuel Neo - avatar