Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the purpose of LPARAMETERS
Message
From
12/06/2014 13:22:40
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601772
Message ID:
01601792
Views:
62
>>If you recall PRIVATE scope is hierarchical - visible down from where a variable is declared all the way into child functions/methods called. LOCAL scope is local to the function the variable is declared at. So LPARAMETERS limits the scope of the parameters - where they are visible - to the function they are declared in.
>>
>>It has nothing to do with passing by value or by reference.

Just to add to Rick's comments, what LPARAMETERS does is hide the variable from anything called by this routine. That is, the difference is relevant in this case:
MyProc1(42)

PROCEDURE MyProc1
PARAMETERS nNum

MyProc2()
?m.nNum  &&  37

RETURN

PROCEDURE MyProc2

* Refer to nNum
nNum = 37

RETURN
and:
PROCEDURE MyProc1
LPARAMETERS nNum

MyProc2()
?m.nNum && 42

RETURN

PROCEDURE MyProc2

* Refer to nNum without declaring it
nNum = 37

RETURN
In the first example, nNum in MyProc1 is changed by MyProc2. In the second, it's not.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform