Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A basic thought about LOCAL variables
Message
From
28/12/1999 11:33:06
 
 
To
28/12/1999 10:31:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00309158
Message ID:
00309205
Views:
30
>I've always thought that a variable created in a method is by default LOCAL and cannot be accessed by higher or lower methods, that is (in my mind) that it cannot be changed by another lower / higher method. That's what I read in the Help.
>

Nope - by default, VFP creates variables not explicitly declared as PRIVATE.

>And that's true most of the time, when you create a simple variable in a method. But it's false when your method calls another method in which you create a local variable with the same name.
>

If you'd explicitly declared the variable as LOCAL, it would have been local and this side-effect would not have occurred. If you'd declared it as LOCAL in the second method, Test2, it would've used the local rather than the PRIVATE inherited from above.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform