Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Default LOCAL variable declaration
Message
De
29/10/2001 12:44:07
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Default LOCAL variable declaration
Divers
Thread ID:
00574603
Message ID:
00574603
Vues:
48
For a long time now, I have had the impression that if you don't declare a variable in a function, it gets declared as a LOCAL the first time you use it. However, this does not seem to be the case...and I just noticed it when I started using VFP7. (I'm also working on some recursive functions)

The following code illustrates the problem:
func1()

FUNCTION func1

 lcVar=[Fred]
 Func2()
 ?lcVar
 
ENDFUNC

FUNCTION func2
    lcVar=[Barney]
    lcVar2=[Wilma]
ENDFUNC	
lcVar in Func1 gets changed by the assignment in func2...if I declare the variable with a LOCAL, it works fine.

So how DO variables get declared by default?

Thanks
Russ
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform