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

Home » Public Forums » archive » Passing zero as a Parameter/ NOT KEYWORD_SET
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Passing zero as a Parameter/ NOT KEYWORD_SET [message #16121] Mon, 28 June 1999 00:00
Grady Daub is currently offline  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.)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Image filtering
Next Topic: Wrapper for WIDGET_DRAW

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

Current Time: Thu Oct 09 21:15:22 PDT 2025

Total time taken to generate the page: 1.19983 seconds