Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A basic thought about LOCAL variables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00309158
Message ID:
00309593
Vues:
35
I see... the key word here being "created", as when the var is created if one does not already exist by that name. I never thought of that... Thanks for clearing that up!
Mark

>I said any variable created without being declared with a specific scope will be created as private. If a private or public variable already exists and you use the assignemnt orpeation to try and create it, you don't create a new var you assign a value to the existing one. So;
>
>lcVar1 = "ABC"
>
>either creates a private variable named lcVar1 or it assigns the value of "ABC" to a variable that already exists. If, instead you say;
>
>PRIVATE lcVar1
>lcVar1 = "ABC"
>
>the first line hides any variable named lcVar1 and then the next line creates a variable named lcVar1 as a private variable. You can see this with the following code;
>
>
>lcVar1 = "ABC"
>DO Proc1
>
>PROCEDURE Proc1
>PRIVATE lcVar1
>lcVar1 = "DEF"
>Display Memory
>Return
>
>
>In display memory you will two variables named lcVar1, one is scoped to the prg and the other is scoped to Proc1. The former will have the value of "ABC" and the later the value of "DEF"
"It hit an iceberg and it sank. Get over it."
Robert Ballard, dicoverer of the Titanic wreckage.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform