Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the purpose of LPARAMETERS
Message
De
12/06/2014 13:22:40
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601772
Message ID:
01601792
Vues:
61
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform