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

Home » Public Forums » archive » Re: user input
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: user input [message #7739 is a reply to message #7733] Thu, 19 December 1996 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Bobby Allen <ballen1@gl.umbc.edu> writes:

> How do you prompt the user for input in idl? Then how would I use that
> input in a switch statement or if statements in IDL?
>
> for example:
>
> I want to prompt the user to enter a 1 or a 2. How would I do that, then
> how would I use that input in my IDl program?

Here is a little program that will do what you want, Bobby. But if
you really want to learn IDL in a short period of time, beg, borrow, or
steal the Learning IDL training manual. It is chock full of
good examples and tutorials and makes learning IDL much, much
easier. If you have to buy it, it costs $50 from RSI. Tell your employeer
I personally guarantee it will make you 500% more productive
while you are there at Goddard!

PRO ASK

; Ask for a 1 or a 2.

prompt = 'Enter a "1" or a "2": '
answer = 0
READ, answer, PROMPT=prompt

; Do something with the value.

IF answer EQ 1 THEN PRINT, 'I got a one!' ELSE $
IF answer EQ 2 THEN PRINT, 'I got a two!'

END

You might also but the answer into a CASE statement rather
than a series of IF statements. Something like this:

CASE answer OF
1: PRINT, 'I got a one!'
2: PRINT, 'I got a two!'
ELSE: PRINT, 'I do not know what I got!'
ENDCASE

Let us know how it goes.

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
[Message index]
 
Read Message
Read Message
Previous Topic: What's the id of that widget?
Next Topic: Re: XGobi

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

Current Time: Sat Oct 11 03:35:24 PDT 2025

Total time taken to generate the page: 0.40184 seconds