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 #64053 is a reply to message #64011] Sun, 30 November 2008 14:06 Go to previous messageGo to previous message
Mark[1] is currently offline  Mark[1]
Messages: 66
Registered: February 2008
Member
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
[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 00:03:37 PDT 2025

Total time taken to generate the page: 0.00532 seconds