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

Private variable in control structure "for" #58

Open
maximilionus opened this issue Oct 17, 2019 · 2 comments
Open

Private variable in control structure "for" #58

maximilionus opened this issue Oct 17, 2019 · 2 comments
Assignees
Labels

Comments

@maximilionus
Copy link

In control structure for [{},{},{}] do {} - variables, defined in this loop like private:

for [{ private _i = 0 }, { _i <= 10 }, { _i = _i + 1 }] do {};

Shows up as possibly undefined
image

But variable _i is defined inside this loop:
image

@SkaceKamen
Copy link
Owner

Oh man, didn't know this is possible ... so variables defined as private in a block are private for that block, with exception of for loop, where they're private for the loop scope? Damn 😄

@SkaceKamen SkaceKamen self-assigned this Oct 18, 2019
@SkaceKamen SkaceKamen added the bug label Oct 18, 2019
@maximilionus
Copy link
Author

@SkaceKamen exactly! Variables, defined like this, will be local to this loop and will not be overridden at each iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants