Forum: Ruby A bit of help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C63db7df007190fd7cfdc0ad01fd1295?d=identicon&s=25 Acoole Cooland (acoole)
on 2007-05-18 17:46
Ok say i was using this code using SciTE

puts 'Hello there, and what\'s your name?'
name = gets
puts 'Your name is ' + name + '?  What a lovely name!'
puts 'Pleased to meet you, ' + name + '.  :)'

After i input my name in the gets, and press enter it just skips the
rest of the program and closes it!

Whats wrong?

Thanks,
C63db7df007190fd7cfdc0ad01fd1295?d=identicon&s=25 Acoole Cooland (acoole)
on 2007-05-18 17:53
bUJMP
2f4d4f9c35ea851bffb9a9cc2e086365?d=identicon&s=25 Harry Kakueki (Guest)
on 2007-05-18 17:57
(Received via mailing list)
On 5/19/07, Acoole Cooland <andrewchinna@yahoo.co.uk> wrote:
> Whats wrong?
>
> Thanks,
>
 Hi,

I don't use  SciTE, but it is probably running so fast you do not see
it and then closes.

Try this.

puts 'Hello there, and what\'s your name?'
name = gets
puts 'Your name is ' + name + '?  What a lovely name!'
puts 'Pleased to meet you, ' + name + '.  :)'
gets


Just put the 'gets' at the end.
That will make the program wait for you to enter something.

Harry



--

A Look into Japanese Ruby List in English
http://www.kakueki.com/
C63db7df007190fd7cfdc0ad01fd1295?d=identicon&s=25 Acoole Cooland (acoole)
on 2007-05-18 18:01
Oh my god!, it worked Thank you guys so much. Ruby-Forum rules!

Thanks,
-Acoole
B8cfd5ec0f88bf5b5f2eedda7d1a0746?d=identicon&s=25 unknown (Guest)
on 2007-05-18 18:06
(Received via mailing list)
In message <71a310f00cdb6c964d3985874131164a@ruby-forum.com>, Acoole
Cooland writes:
>Whats wrong?
What's wrong is that you're not fast enough to read the message before,
a microsecond or three later, the computer realizes that the program
has exited and closes the window.

-s
This topic is locked and can not be replied to.