Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goto, but why? correction #356

Open
62830 opened this issue Nov 21, 2024 · 0 comments
Open

goto, but why? correction #356

62830 opened this issue Nov 21, 2024 · 0 comments

Comments

@62830
Copy link

62830 commented Nov 21, 2024

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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant