Forum: Ruby Re: Simultaneous text input/output in a command line game

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.
397f61cc4458e13157b4facf72325e5f?d=identicon&s=25 Gennady Bystritsky (Guest)
on 2006-02-12 07:17
(Received via mailing list)
Just from the tip of my head:

t = Thread.new {
  while true
    sleep 5
    puts "What are you waiting for, dude? Enter something now: "
  end
}
puts "Enter something: "
s = gets
t.kill
puts "You entered: #{s.inspect}"

Gennady.
This topic is locked and can not be replied to.