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

Update control-flow.markdown - for statement section #1177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PureFox48
Copy link
Contributor

Fixes #1176.

Copy link

@RobLoach RobLoach left a comment

Choose a reason for hiding this comment

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

Good call to mention that variable scope it kept for the function.

It may make more sense to document this in the Functions section, as this seems more like a property of closures, rather than loops and control flow.

@PureFox48
Copy link
Contributor Author

Well, the Closures section already makes clear what it means to capture a variable.

This PR is peculiar to the for statement where it looks like there’s only one variable for the entire loop when in fact there’s a separate instance for each iteration. Although this only really manifests itself when there’s a closure involved, I still think that the Control Flow section is the best place to put it.

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.

Should we document this aspect of for loop control variable behavior?
2 participants