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

Home » Public Forums » archive » 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 #64048 is a reply to message #64011] Mon, 01 December 2008 06:11 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Nov 30, 5:06 pm, Mark <mark.h...@gmail.com> wrote:
> On Nov 28, 11:02 pm, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
>
>> The usecase for me is to call a helper routine if not enough parameters
>> were used.
>
>> e.g.
>
>>  if n_params() lt 2 then begin
>>       MESSAGE,call_help(),/cont
>>       return
>>  endif
>
> Sure, but even if 2 parameters were supplied, you still don't know if
> the variables they're associated with are defined. If you're going to
> check for that anyway, with N_ELEMENTS, the N_PARAMS check is
> redundant.
>
> Eg.
>
> pro mypro, a, b
>
> if n_elements(a) eq 0 || n_elements(b) eq 0 then begin
>        MESSAGE,call_help(),/cont
>        return
> endif
>
> end

Except that there are valid reasons for passing in an undefined
variable, if it's used for output. So it's perfectly legitimate to
want to know whether it was passed in without caring whether it is
defined.

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Bug in N_PARAMS?
Next Topic: Re: streamlines over contour without iVector

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

Current Time: Fri Oct 10 15:35:27 PDT 2025

Total time taken to generate the page: 0.48223 seconds