Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local vs private
Message
De
10/08/2005 09:36:58
 
 
À
09/08/2005 19:54:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01039725
Message ID:
01039846
Vues:
22
Look at this example
PROCEDURE One
TheVar = "This is from Proc One"
DO Two
?? TheVar   && Prints "This is from Proc One"

PROCEDURE Two
? TheVar    && Prints "This is from Proc One"
PRIVATE TheVar
TheVar = "This is from Proc Two"
? TheVar    && Prints "This is from Proc Two"
RETURN
So, you can use PRIVATE to hide the previous declaration and reuse the variable name.

FYI, it is considered best practice to use LOCAL variables.


>Thanks Jim -
>If an undeclared variable is PRIVATE by default, what is the point of the command? Can you give me an example?
>
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform