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

Home » Public Forums » archive » Re: CASE statement
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: CASE statement [message #26550 is a reply to message #26549] Fri, 07 September 2001 13:39 Go to previous messageGo to previous message
Stein Vidar Hagfors H[1] is currently offline  Stein Vidar Hagfors H[1]
Messages: 56
Registered: February 2000
Member
David Fanning <david@dfanning.com> writes:

> K Banerjee (kbanerje2@home.com) writes:
>
>> In IDL, is it possible to use mulitple expressions with a single
>> statement?
>>
>> Something like:
>>
>> PRO CASE1, Tag
>>
>> case Tag of
>>
>> ;; The following line does not work.
>> ('TIFF') or ('tiff'): begin
>> print, "TAG is TIFF"
>> end
>>
>> else: begin
>> print, "TAG is UNKNOWN"
>> end
>>
>> endcase
>>
>> end
>
> No. The proper form of this CASE statement looks
> like this:
>
> CASE StrUpCase(tag) OF
> 'TIFF': Print, 'Tag is TIFF'
> ELSE : Print, 'Tag is Unknown'
> ENDCASE

"The proper form" ?

Well, not that I've ever used it myself, but I have seen another nifty form,
something like this:

case 1 of
(tag eq 'TIFF') or $
(tag eq 'TAFF') or $
(tag eq 'FIFF') : begin & print,"Tag is TIFF (or a typo thereof)" & end

(tag eq 'GIF') or $
(tag eq 'GUF') : begin & print,"Tag is GIF (or a typo thereof)" & end

:

ELSE: print, "Tag is unknown"
end

The "ELSE" part can of course be written like this (saves 3 keystrokes :-)

1: print,"Tag is unknown"

Whether this is a "proper form", I'll leave up to David :-)

--
------------------------------------------------------------ --------------
Stein Vidar Hagfors Haugan
ESA SOHO SOC/European Space Agency Science Operations Coordinator for SOHO

NASA Goddard Space Flight Center, Email: shaugan@esa.nascom.nasa.gov
Mail Code 682.3, Bld. 26, Room G-1, Tel.: 1-301-286-9028/240-354-6066
Greenbelt, Maryland 20771, USA. Fax: 1-301-286-0264
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Drawing 2 or 3 contours on a same image
Next Topic: Using IDL with Java

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

Current Time: Wed Oct 08 19:34:43 PDT 2025

Total time taken to generate the page: 0.00604 seconds