[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: translating an array name to a string

Craig Markwardt wrote:
> Craig Markwardt <craigmnet@cow.physics.wisc.edu> writes:
> > Second, your check to see if a variable is undefined is rather
> > convoluted.  It involves two passes to get it right.  I prefer instead
> > to use the N_ELEMENTS command to immediately determine whether a
> > variable is undefined.  Unlike *assigning* an undefined variable,
> > which does produce an error, simply taking the N_ELEMENTS of an
> > undefined variable will not cause an error.
> Ooops, this is actually a mistake on my part, at least on versions of
> IDL earlier than v5.3.
>  * succeed if a variable exists and is defined
>  * return an undefined value if the variable exists but is undefined
>  * utterly fail if the variable doesn't exist, stopping execution

That's not the behavior I see in 5.3.  I get the 2nd behavior for both
of the latter two cases, and your first code version works as
advertised.  (I like it better too.)  


 J.D. Smith                  |   WORK: (607) 255-6263
 Cornell Dept. of Astronomy  |         (607) 255-5842
 304 Space Sciences Bldg.    |    FAX: (607) 255-5875  
 Ithaca, NY 14853            |