Re: Help needed for a CASE statement, something subtle going on ... [message #87780 is a reply to message #87777] |
Wed, 26 February 2014 16:08   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
Summarizing what Craig and David have said: this all goes back to the difference in a
1) script (run with IDL>@case_st)
2) main level program (run with IDL>.run case_st
3) procedure (run with IDL>case_st
One of times I use scripts is for a "make" file for GUIs. Usually, I write procedures though. Far better programming practice.
I keep a "temp" main level program laying around to "play around" in. Usually, it's a precursor for a procedure I end up writing.
I also use main level programs as "wrappers" - usually for some sort of analysis that needs to be repeated over and over.
On Wednesday, February 26, 2014 4:57:47 PM UTC-6, David Fanning wrote:
> But, you can't execute multiple
>
> line statements such as CASE statements, FOR loops, etc at the command
>
> line. (People will tell you differently and then offer you 1970's syntax
>
> to do so. Don't listen to them.)
>
>
Then don't listen to this :-)
If you absolutely *must* you can do this in a script. Here's the 1970's syntax (it's not pretty and *very* cumbersome)
CASE x OF & $
1: print, 'one' & $
2: print, 'two' & $
3: print, 'three' & $
4: print, 'four' & $
ELSE: print, 'not one through four' & $
ENDCASE
Again, this should be a last resort.
|
|
|