Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variable Existence Check
Message
De
30/09/1998 10:44:30
 
 
À
30/09/1998 10:26:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00142381
Message ID:
00142390
Vues:
19
>I'd like to check if a variable exists. Can someone point me to the function for this?
>
>It would work just like FOUND(), returning a .t. if the var exists and .f. if it does not.
>

Try the TYPE() function; if given the name of a variable (or property, or field) as an ASCII string, it returns a single character designating the data type. An undefined name will return 'U'. So:
Var1 = 0
? 'Created'
IF TYPE('Var1') # 'U'
   ? 'The variable Var1 exists'
ELSE
   ? 'Var1 does not exist'
ENDIF
RELEASE Var1
? 'released'
IF TYPE('Var1') # 'U'
   ? 'The variable Var1 exists'
ELSE
   ? 'Var1 does not exist'
ENDIF
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform