Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the purpose of LPARAMETERS
Message
 
 
To
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:
01601802
Views:
42
>>>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

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform