Hi!
You can use type() function to see if variable already exists. If variable exists, use type("MyArray[1]") == "U" to see if it is array.
However, indeed, type() function works slowly. In usual case in some kind of the algorithm it is much better to add a logical flag that will become .T. as soon as array defined. Example:
local llArrayCreated
....
if llArrayCreated AND len(MyArray,1)=nSomeValue && note that len() will not be evaluated when
&& llArrayCreated is .F. - VFP do not continue to calculate logical expression
&& when its result is alredy determined for sure. This could be not true for
&& some other programming languages, for example, for VB
...
dimension MyArray(...)
llArrayCreated = .T.
...
endif
Above is much more clear and more natural way of programming for all programming languages.
HTH.
>I am using an array in a program and on the first pass through a method, it is possible that the array hasn't been created yet (the routine is primarily for subsequent passes). Of course I get an error when I do a ALEN on the non-existant array. I have tried various commands to see if I can check for it but they all generate an error. Is there a command that can tell if an array (or variable of anytype), exists without generating an error?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.