Name and favourite colour [message #85105] |
Thu, 04 July 2013 11:28  |
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 #85115 is a reply to message #85105] |
Fri, 05 July 2013 23:19   |
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 #85215 is a reply to message #85116] |
Mon, 15 July 2013 13:41  |
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
|
|
|