Hi all,
It appears that I have no access inside a for or while loop to variables that are declared as part of the loop construction or outside of the loop, and I cannot find any documentation using standard programming terms such as "scope" to explain how to work around. What I'd like to do is something like:
local i = 0
while `i' < 100 {
if condition {
++`i'
}
else {
local i = somefunction(`i')
}
}
I can change the value of i, but when the code loops, it returns to the value set outside of the loop. same thing with forvalues{}
Any help is appreciated
It appears that I have no access inside a for or while loop to variables that are declared as part of the loop construction or outside of the loop, and I cannot find any documentation using standard programming terms such as "scope" to explain how to work around. What I'd like to do is something like:
local i = 0
while `i' < 100 {
if condition {
++`i'
}
else {
local i = somefunction(`i')
}
}
I can change the value of i, but when the code loops, it returns to the value set outside of the loop. same thing with forvalues{}
Any help is appreciated
Comment