Forum: Ruby Newbie Basic Command Interpreter Question in Ruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8fd4375f345fb3e46cc7c1b275bcfcea?d=identicon&s=25 Andrea Maschio (Guest)
on 2007-01-29 10:41
(Received via mailing list)
Hello Folks, i'm a newbie who desires to implement a basic command
interpreter written in ruby. Let's say i want to start a new Thread who
listen to user input{
    puts "thread started"
    loop do

      exit if (a=="quit\n")
      puts a


outputs "thread started" and exits

What i'm i doing wrong? Why the tread doesn't continue looping but
Sorry for the newbie question, i'm just learning ruby.

Thank you very much for answering

05be5d6610e2c3f1780aa0e39e902e93?d=identicon&s=25 Farrel Lifson (Guest)
on 2007-01-29 11:45
(Received via mailing list)
On 29/01/07, Andrea Maschio <> wrote:
>       puts a
> Thank you very much for answering
> Andrea

The p thread is started but the main execution thread (which spawned
the p thread) exits the interpreter. You need to add a 'p.join' at the
end which will wait for p to finish before continuing.

This topic is locked and can not be replied to.