For a long time now, I have had the impression that if you don't declare a variable in a function, it gets declared as a LOCAL the first time you use it. However, this does not seem to be the case...and I just noticed it when I started using VFP7. (I'm also working on some recursive functions)
The following code illustrates the problem:
func1()
FUNCTION func1
lcVar=[Fred]
Func2()
?lcVar
ENDFUNC
FUNCTION func2
lcVar=[Barney]
lcVar2=[Wilma]
ENDFUNC
lcVar in Func1 gets changed by the assignment in func2...if I declare the variable with a LOCAL, it works fine.
So how DO variables get declared by default?
Thanks
Russ