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

Home » Public Forums » archive » dealing with arguments
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: dealing with arguments [message #71265 is a reply to message #71119] Wed, 02 June 2010 15:43 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
> Oh! And how do I set default values? For example, to make s2 always
> equal 10 if no other value is provided in the call.

pro name, mode, s1=s1, s2=s2
s2=n_elements(s2) ne 0 ? s2 : 10
...
end

Which you could then call as

name, 2, s2=100

It would make s2=10 if it is not provided (or is given an undefined
variable).

By the way, it could also be called with

name, s2=100, 2

as it does not matter in which order you supply the keywords.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: dealing with arguments
Next Topic: trying to find land/water coverage maps for NA

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

Current Time: Fri Oct 10 05:47:27 PDT 2025

Total time taken to generate the page: 0.08297 seconds