I'm not sure about the following:
when I use a recurive function call, eg:
global b
test()
waitkey()
end
function test()
local a=rand(100)
print a
b=b+1
if b<2 then test()
b=b-1
print a
waitkey()
end function
(b is the recursion depth limiter here)
THe question is: when I got a local variable in a function that is called recursively, will always the same A be used (since it's in the same function), or has each "instance" of the recursion its own A variable, that is only affected by the immediate instance?
Right now it seems to me the second is true. but I'd like to see this confirmed.
when I use a recurive function call, eg:
global b
test()
waitkey()
end
function test()
local a=rand(100)
print a
b=b+1
if b<2 then test()
b=b-1
print a
waitkey()
end function
(b is the recursion depth limiter here)
THe question is: when I got a local variable in a function that is called recursively, will always the same A be used (since it's in the same function), or has each "instance" of the recursion its own A variable, that is only affected by the immediate instance?
Right now it seems to me the second is true. but I'd like to see this confirmed.