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

Re: undefined keyword variables



Craig Markwardt (craigmnet@cow.physics.wisc.edu) writes:

> As to David's suggestion to define default values, that's not always
> feasible.  What about the POSITION keyword?  If it's not defined then
> you want to rely on IDL's standard positioning.  No default should be
> required!

I think it is not only feasible, but required, that you 
provide default values for *any* variable you plan
to use in the code. Certainly if I were planning to
use the POSITION keyword I would have something like this:

   IF N_Elements(thePosition) EQ 0 THEN thePosition=!P.Position
   ...
   Plot, data, Position=thePosition

As for keywords that come in with _Extra, well, that's
what God made the Catch statement for. :-)

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155