python-goto
python-goto copied to clipboard
Unknown label SyntaxError for labels after the return statement
I get the following exception when I run the program below: Exception has occurred: SyntaxError Unknown label 'a'
from goto import with_goto
@with_goto
def main(x):
if x == 0:
goto.a
return x
label.a
x += 1
return x
Exception has occurred: SyntaxError
Unknown label 'a'
from goto import with_goto
@with_goto
def main(x):
if x == 0:
goto.a
return x
label.a
x += 1
return x
You can get w/o error.
@pamelamei That is not helpful, as it breaks the intended flow of the function. Plug in some values, you'll see the difference. (I too am having this problem, labels that occur after the return command are not recognized.)