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

Home » Public Forums » archive » Re: Bug in N_PARAMS?
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: Bug in N_PARAMS? [message #63983 is a reply to message #63974] Tue, 25 November 2008 23:53 Go to previous messageGo to previous message
Carsten Lechte is currently offline  Carsten Lechte
Messages: 124
Registered: August 2006
Senior Member
Kenneth P. Bowman wrote:
> to provide default values for optional parameters.

I wrote this little procedure for setting default values
that I use a zillion times a day:


PRO defaultarg, arg, defval, VALUEGIVEN=valuegiven

IF N_ELEMENTS( arg) EQ 0 THEN BEGIN
arg = defval
valuegiven = 0
ENDIF ELSE valuegiven = 1

END

then use it like this:

PRO somepro, arg1, arg2, KEY1=key1

defaultarg, arg1, 0
defaultarg, arg2, 'test'
defaultarg, key1, 2343d8

...

END



chl
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: areas with 'hatching' in plots?
Next Topic: Bug in N_PARAMS?

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

Current Time: Wed Oct 08 19:02:01 PDT 2025

Total time taken to generate the page: 0.02040 seconds