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

Home » Public Forums » archive » Easy question?
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: easy question [message #45753 is a reply to message #16325] Thu, 06 October 2005 19:48 Go to previous messageGo to previous message
mperrin+news is currently offline  mperrin+news
Messages: 81
Registered: May 2001
Member
Both Michael and Haje are correct that one can use a case statement
for this sort of thing. But IDL handles a series of if statements just
fine, too:

pro demo, arg

if arg eq 1 then begin
print,"one"
endif else if arg eq 2 then begin
print,"two"
endif else begin
print, "many"
endelse

end

This requires typing a lot more characters than the case version,
but I think it can sometimes make the program logic a bit clearer.
Either way works, so feel free to use whichever idiom you feel more
comfortable with.

- Marshall
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Five days mean values
Next Topic: Re: how to use map_set in object graphics programming

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

Current Time: Sat Oct 11 06:05:18 PDT 2025

Total time taken to generate the page: 0.40569 seconds