Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default LOCAL variable declaration
Message
From
29/10/2001 12:44:07
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Default LOCAL variable declaration
Miscellaneous
Thread ID:
00574603
Message ID:
00574603
Views:
49
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
Next
Reply
Map
View

Click here to load this message in the networking platform