Discuss the future of the AutoHotkey language
3 posts • Page 1 of 1
In "for k, v in obj", v2 is supposed to localize k and v, which personally I think is the way to go. I was actually really surprised when I found out v1.1 didn't do this. However, "for" loops in an assume-global function still make k and v global variables. Is this the intended effect? If so, I vote to keep the behaviour consistent.
Perhaps I'm mistaken and they do perform the same... I thought I tested it and saw that k and v didn't show up on the global variables list when a for loop is used in the main script body, but it looks like I was wrong...
The word localize might have been used in the docs at some point, I can't find it now. There shouldn't be any confusion now,In "for k, v in obj", v2 is supposed to localize k and v
It works.When the loop breaks or completes, these variables are restored to their former values.
You should use local appropriately, as you do for any other variables.
Who is online
Users browsing this forum: No registered users and 13 guests