python-goto icon indicating copy to clipboard operation
python-goto copied to clipboard

Unknown label SyntaxError for labels after the return statement

Open mcorne opened this issue 5 years ago • 2 comments

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'

mcorne avatar May 14 '20 08:05 mcorne

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 avatar Jun 21 '20 10:06 pamelamei

@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.)

skralg avatar Jul 13 '20 20:07 skralg