Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A basic thought about LOCAL variables
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00309158
Message ID:
00309658
Views:
35
> ...That way ALL undeclared variables would be private, and you must specify that you're referencing a variable created elsewhere, IMO.

So, in this scenario, what is a private variable? You would only have locals adn publics. A private variable is a variable that exists from teh time it is created until it is explicitly released or the routine that created it ends. A private variable is visible to the roputine that creates it and all routines called form that one. So prg1 creates a private variable named lcVar and prg2 has this line in it;

lcVar = "DEF"

what does the assignment line do? It assigns a value to the private variable created above. In fact, declaring a PRIVATE variable does absolutely nothing to the variable you declare, it hides any existing vars with that name. So PRIVATE lcVar does not create a private variable named lcVar, it tells fox to hide any vars that exist with the name lcVar. In fact lcVar won't exist after that until you assign it a value.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform