Help needed for a CASE statement, something subtle going on ... [message #87773] |
Wed, 26 February 2014 14:42  |
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
|
|
|