Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Different between private and local
Message
De
01/11/2000 04:59:20
 
 
À
01/11/2000 02:23:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00436575
Message ID:
00436595
Vues:
17
Jasper,

Here's the difference in PRIVATE & LOCAL variables:

LOCAL:

Local variables and variable arrays can be used and modified only within the procedure or function in which they are created, and cannot be accessed by higher- or lower-level programs. Local variables and arrays are released once the procedure or function containing the local variables and arrays completes execution.

Variables and arrays created with LOCAL are initialized to false (.F.). Any variable or array you wish to declare as local must be declared local prior to assigning it a value. Visual FoxPro generates an error message if you assign a value to a variable or array and later declare it local with LOCAL.

Local variables can be passed by reference.


PRIVATE:

Hides specified variables or arrays that were defined in a calling program from the current program.

The hiding of variables created in higher-level programs enables variables of the same name as the private variables to be manipulated in the current program without affecting the values of the hidden variables. Once the program containing PRIVATE has completed execution, all variables and arrays that were declared private are again available.

PRIVATE doesn't create variables; it simply hides variables declared in higher-level programs from the current program.


Since using VP, I've tended to use LOCAL all the time, as it's easier to manage.

Andy Crawshaw
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform