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

Home » Public Forums » archive » procedure in 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: procedure in case statement [message #82130 is a reply to message #82049] Mon, 19 November 2012 12:13 Go to previous messageGo to previous message
Russell Ryan is currently offline  Russell Ryan
Messages: 122
Registered: May 2012
Senior Member
On Monday, November 19, 2012 10:57:00 AM UTC-5, hann...@web.de wrote:
> thanks a lot, paulv and DavidF. now it works.
>
> i'm sorry if my question was formulated kind of inconvenient and ineffectively - it was my first post and i will work on that.
>
> hannah

Hi Hannah,

Yeah the problem your having is that IDL will default a datatype as a float, and you're trying to assign it a float. So, you need to explicitly set the type to string before hand. When I do this, I usually do:

ans='proc1' ; or the default setting
read,'Which procedure do you want to run: ',ans
case ans of
'proc1':
'proc2':
endcase

But, this can be very dangerous for a slew of reasons. (1) what if the user misspells the procedure? (2) what if they type something that's disallowed? (which I guess is like (1)), (3) what if they capitalize? Obviously, you can see a host of problems. To guard against these things you should set default settings, have an "else" clause in your case, and check capitalization.

Good luck,
Russell
[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
Read Message
Read Message
Previous Topic: Re: Can't get out of define mode in ncdf, not specific to variable.
Next Topic: Can't get out of define mode in ncdf, not specific to variable.

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

Current Time: Fri Oct 10 08:35:11 PDT 2025

Total time taken to generate the page: 0.72496 seconds