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.
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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs