Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strong declaration?
Message
De
05/09/2001 16:28:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00552778
Message ID:
00552799
Vues:
17
>>Hi all,
>>
>>What is the difference when declaring a variable using AS option and not using it?
>>
>>
>>local m.myInteger
>>?type('m.myInteger') && 'L'
>>
>>local m.myOtherInteger AS Integer
>>?type('m.myOtherInteger') && 'L'
>>
>>
>>I was hoping that on the second declaration, m.myOtherInteger would have defaulted to 0. Aside from knowing that the variable will become an integer somewhere in the code, I don't see any advantage to declaring it with the AS keyword.
>>
>>Thoughts please.
>
>Ramil;
>
>In VB you would declare the type of variable but not in VFP. The value of the variable must be declared. I have not tried using a mvar (m.myOtherInteger) and would have just defined
>
>Local myOtherInteger
>myOtherInteger = 0
>
>Tom

In VFP 7, this is now possible.

I'm not sure but m.var is handle similarly as var in VFP. I just make it a habit to use the m. prefix whenever possible to help me identify that I'm refering to a variable as opposed to table fieldname (although I almost always use alias prefix as well).
ramil
~~ learning to stand still
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform