Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Declared Variable or not
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00392683
Message ID:
00392772
Vues:
9
>>>Is there a way to check to see if a variable exists or not. For instance, if var1 exists, do whatever, but if not, declare it and then do it.
>>>
>>>Same question goes for arrays and objects. If form exists, do something... if not, do something else or create it.
>>
>>TYPE('var1') or VARTYPE(var1) equals "U" is about as close as you can get. If the variable's scope is defined (LOCAL var1), they'll (the functions) return "L"
>
>Rats, you beat me by 25 seconds.
>
>Vartype() is good for checking non-array variables. However, it throws an error if you use it to check if a variable is an array and it isn't.
>
>"File 'array name.prg' does not exist".

Oh drat! I didn't mean it.:-)

Arrays are always problematical, so I didn't try to deal with them. Personal preference.< s >
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform