Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

Is there a goto or any equivalent in Python to be able to jump to a specific line of code?

1 Answer

0 votes
by (106k points)

You can use the function decorator that enables goto in Python, just like as follows:-

from goto import with_goto 

@with_goto 

def range(start, stop): 

i = start 

result = [] 

label .begin 

if i == stop: 

goto .end 

result.append(i) 

i += 1 

goto .begin 

label .end 

return result

Browse Categories

...