Passing zero as a Parameter/ NOT KEYWORD_SET [message #16121] |
Mon, 28 June 1999 00:00 |
Grady Daub
Messages: 22 Registered: June 1999
|
Junior Member |
|
|
How can I pass the number zero as a parameter, without the
function/subroutine thinking that the parameter is not set?
For example:
;code
pro bob, in=in, out=out
if keyword_set(in) the out=in+200
end
;pretend sample runs
#1... I want the number 201
IDL>bob,in=1,out=out
IDL>print,out
201
#2...I want the number 200
IDL>bob,in=0,out=out
IDL>print,out
%PRINT:Variable is undefined: OUT.
%Execution halted at: $MAIN$
Also, why does:
IF NOT KEYWORD_SET(keyword) then do-this-stuff
not work?
I've had to do the following:
IF KEYWORD_SET(keyword) then a=a else do-this-stuff
("a=a" acts as some kind of dummy variable thing.)
-Grady Daub
(Remove MMER and ZOOKS to reply by e-mail.)
|
|
|