wtfpython icon indicating copy to clipboard operation
wtfpython copied to clipboard

goto, but why? correction

Open 62830 opened this issue 11 months ago • 2 comments

Hi,

If I'm not mistaken, I think the "goto, but why?" section missed one I am trapped, please rescue! Can you help double check it? (or am I missing some April Fool's joke?)

The code is

from goto import goto, label
for i in range(9):
    for j in range(9):
        for k in range(9):
            print("I am trapped, please rescue!")
            if k == 2:
                goto .breakout # breaking out from a deeply nested loop
label .breakout
print("Freedom!")

The output should be

I am trapped, please rescue!
I am trapped, please rescue!
I am trapped, please rescue!
Freedom!

Instead of

I am trapped, please rescue!
I am trapped, please rescue!
Freedom!

62830 avatar Nov 21 '24 19:11 62830