/pygoto

Use goto in Python

Primary LanguagePythonMIT LicenseMIT

Pygoto

Use goto in Python

Installation

From PyPI

pip3 install pygoto

From GitHub

pip3 install git+https://github.com/donno2048/pygoto

Usage / Examples

from goto import goto
flag = False
flag = not flag
print(0)
if flag:
    goto(3)
print(1)
0
0
1
from goto import goto
sum = 0
for i in range(10):
    sum += i
    if i == 5:
        goto(7)
print(sum)
15
from goto import goto
def zero(): 1/0
goto(5)
zero()
print("Done!")
Done!
from goto import goto
def zero(): 1/0
goto(4)
zero()
print("Done!")
Traceback (most recent call last):
  File "main.py", line 4, in <module>
    zero()
  File "main.py", line 2, in zero
    def zero(): 1/0
ZeroDivisionError: division by zero
from goto import goto
def zero(): 1/0
goto(3)
zero()
print("Done!")
You have passed the recursion limit, please check your goto