Pass-By-Reference question. (ARG_PRESENT) [message #38587 is a reply to message #38509] |
Fri, 12 March 2004 11:52   |
Andry William (Please
Messages: 11 Registered: March 2004
|
Junior Member |
|
|
> pro whaddup, nodata=nodata,_REF_EXTRA=_extra
>
> nodata_internal = 0
> if(arg_present(nodata)) then nodata_internal=nodata > 0 < 1
>
Hi All,
This might be off topic but can somebody explain to me why the
following statements give different result. (Maybe I did not really
understand the IDL manual). (I am using IDL 6.0).
I have the following procedure:
PRO t_arg_present,arg1=arg1
IF KEYWORD_SET(arg1) THEN PRINT, "'arg1' is set to ", arg1
IF ARG_PRESENT(arg1) THEN PRINT, "'arg1' is present", arg1
END
If I do:
IDL> t_arg_present,arg1=1
It returns:
'arg1' is set to 1
If I do:
IDL> t_arg_present,arg1=0
Nothing comes out.
If I do:
IDL> a=0
IDL> t_arg_present,arg1=a
It returns:
'arg1' is present 0
If I do:
IDL> a=1
IDL> t_arg_present,arg1=a
It returns:
'arg1' is set to 1
'arg1' is present 1
Are all the output the expected one?
Thanks,
Andry
|
|
|