Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing for presence of an array?
Message
From
04/05/2005 19:21:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
04/05/2005 19:18:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01011099
Message ID:
01011101
Views:
15
>Hi. How do you test for the presence of an array?
>
>Thanks, Randy

I think it is something like this:
if type("MyVar") # "U"
  * The variable or array exists
endif

if type("MyVar(1)") # "U"
  * The variable exists, and is an array
endif
You might also test with vartype() (without the quotation marks), which is supposed to be faster.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform