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

break/continue loop/while/until/for/do refer to anonymous containing iteration #1642

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

edemaine
Copy link
Collaborator

As mentioned in Discord, this seems in line with continue switch and fairly intuitive.

It is technically a breaking change, but these seem like unlikely constructions:

  • old break loop (infinitely many breaks) is equivalent to break
  • old break while cond() is equivalent to break if cond() (and is now a parse error)
  • old break until cond() is equivalent to break unless cond() (and is now a parse error)

Copy link
Contributor

@STRd6 STRd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good!

For the compatibility of previous break while cond() is closer to equivalent to cond() since it checks the cond and breaks from inside the wile, it wouldn't affect outside.

I don't think we need to worry about it since probably no one used it unless by accident.

@edemaine edemaine merged commit 1b1d825 into main Dec 12, 2024
4 checks passed
@edemaine edemaine deleted the break-loop branch December 12, 2024 12:45
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

Successfully merging this pull request may close these issues.

2 participants