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

Home » Public Forums » archive » Help needed for a CASE statement, something subtle going on ...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Help needed for a CASE statement, something subtle going on ... [message #87773] Wed, 26 February 2014 14:42 Go to previous message
john.hrv583 is currently offline  john.hrv583
Messages: 4
Registered: February 2014
Junior Member
Hi,

I'm learning to use CASE statements in IDL, and have tried to put the following code lines

-----------------------------------------------------
x = 2

CASE x OF
1: print, 'one'
2: print, 'two'
3: print, 'three'
4: print, 'four'
ELSE: print, 'not one through four'
ENDCASE
----------------------------------------------------

into a file called "case_st.pro". I then tried to run it under IDL using
"@case_st", but got the following messages:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@case_st
% Case statement found no matches.
% Execution halted at: $MAIN$

1: print, 'one'
^
% Syntax error.
At: /C1/ryu/IDL_tools/examples/case_st.pro, Line 4

2: print, 'two'
^
% Syntax error.
At: /C1/ryu/IDL_tools/examples/case_st.pro, Line 5

3: print, 'three'
^
% Syntax error.
At: /C1/ryu/IDL_tools/examples/case_st.pro, Line 6

4: print, 'four'
^
% Syntax error.
At: /C1/ryu/IDL_tools/examples/case_st.pro, Line 7

ELSE: print, 'not one through four'
^
% Syntax error.
At: /C1/ryu/IDL_tools/examples/case_st.pro, Line 8

ENDCASE
^
% Syntax error.
At: /C1/ryu/IDL_tools/examples/case_st.pro, Line 9

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++

That's a bit surprising, because this is one of the examples that I found on the web about the usage of CASE statements, and I just copied the example code into a text file. I checked the IDL manual, and also compared the code with codes I saw on different websites, but could not find out what's wrong with the syntax of the case statements. So I guess something subtle is going on here, and it's quite frustrating, because I tried different things, and also some different examples, but they all gave this kind of syntax errors. So there must be something that I have done totally wrong.

Your help would be highly appreciated!

John
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Wrapping image on polar projection
Next Topic: Re: Guide: how to call Fortran from IDL in a portable and stardard F 2003 way

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

Current Time: Wed Oct 08 15:28:14 PDT 2025

Total time taken to generate the page: 0.00367 seconds