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

Home » Public Forums » archive » Name and favourite colour
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Name and favourite colour [message #85105] Thu, 04 July 2013 11:28 Go to next message
don.doran is currently offline  don.doran
Messages: 3
Registered: July 2013
Junior Member
Hi people,
I'm a newby student to idl. One problem which has stumped me is:
Write a programme that asks for your name and favorite color, and then prints out a sentence that includes them. I think this uses the read command, but so far unable to get anything that works. Help. Cheers, Don
Re: Name and favourite colour [message #85106 is a reply to message #85105] Thu, 04 July 2013 12:44 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
Yep, it's the READ command. The help has an example:

http://www.exelisvis.com/docs/READ.html

Using the top example on that page, a simple

IDL> print, B

will print whatever the user entered.
Re: Name and favourite colour [message #85115 is a reply to message #85105] Fri, 05 July 2013 23:19 Go to previous messageGo to next message
don.doran is currently offline  don.doran
Messages: 3
Registered: July 2013
Junior Member
On Thursday, 4 July 2013 19:28:19 UTC+1, don....@btinternet.com wrote:
> Hi people,
>
> I'm a newby student to idl. One problem which has stumped me is:
>
> Write a programme that asks for your name and favorite color, and then prints out a sentence that includes them. I think this uses the read command, but so far unable to get anything that works. Help. Cheers, Don

Thanks for that help Phillip, what I understand now is:
read, a, b, prompt="Enter name and favorite colour."
;;Assuming I enter Don and yellow, then.
PRINT, "Hi Don, your choice of yellow is a good one."
;;I can't figure out how the computer picks up my name and colour to include in the sentence. Cheers, Don
Re: Name and favourite colour [message #85116 is a reply to message #85115] Sat, 06 July 2013 17:06 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> ;;I can't figure out how the computer picks up my name and colour to include in the sentence. Cheers, Don

It seems like you have all of the pieces... maybe your are missing the string concatenation?


favorite_fruit = 'watermelon'
print, 'My favorite fruit is ' + favorite_fruit + '. It is delicious.'
Re: Name and favourite colour [message #85215 is a reply to message #85116] Mon, 15 July 2013 13:41 Go to previous message
don.doran is currently offline  don.doran
Messages: 3
Registered: July 2013
Junior Member
On Sunday, 7 July 2013 01:06:20 UTC+1, Matthew Argall wrote:
>> ;;I can't figure out how the computer picks up my name and colour to include in the sentence. Cheers, Don
>
>
>
> It seems like you have all of the pieces... maybe your are missing the string concatenation?
>
>
>
>
>
> favorite_fruit = 'watermelon'
>
> print, 'My favorite fruit is ' + favorite_fruit + '. It is delicious.'

Thanks Mathew, I will give this a try at the Uni idl term. Cheers, Don
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Debugging Java Bridge CLASSPATH issues?
Next Topic: question on exactly when !p.position is defined

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

Current Time: Wed Oct 08 13:35:38 PDT 2025

Total time taken to generate the page: 0.00666 seconds