comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » keyword_set bug or feature
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: keyword_set bug or feature [message #4225 is a reply to message #4216] Fri, 12 May 1995 00:00 Go to previous messageGo to previous message
wmc is currently offline  wmc
Messages: 117
Registered: February 1995
Senior Member
In article 5pc@info.epfl.ch, llobet@elpp1.epfl.ch (Xavier Llobet i Sales EPFL-CRPP 1015 Lausanne CH) writes:
>
> In article <PHIL.95May12090139@peace.med.ohio-state.edu>,
> phil@peace.med.ohio-state.edu (Phil) writes:

> =It has to do with keywords in functions or procedures. I use several and
> =check to see if the are set using
> = IF NOT(keyowrd_set(key)) THEN BEGIN
> = ;set a default value here
> = ENDIF

> =The problem comes in if the user wants to set key = 0. If so then it
> =appears to the above test that the keyword is not set even though in
> =the function call the user typed

> = Result = somefunction(var,key=0)

> You could try
> IF N_ELEMENTS(key) EQ 0 THEN BEGIN

Another solution is to set key=[0], ie the array containing 0.
Then keyword_set returns true, and IDL happily uses [0] and 0 fairly
interchangably.

- William Connolley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Angstrom symbol
Next Topic: IDL spreadsheet??

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:48:41 PDT 2025

Total time taken to generate the page: 7.84466 seconds