From: "Jesús Gabriel y Galán" Date: 2010-03-26T18:55:14+09:00 Subject: Re: user input timeout. On Fri, Mar 26, 2010 at 10:17 AM, Rico Knoop wrote: > i'v bin programming for about 2 week now and just about completed > http://pine.fm/LearnToProgram/ > > but for a change of pace i started something of my own but i cant seem > to get my program to wait X-seconds for user input. > > basicly what i got is: > > input= "empty" > input= gets.chomp > > if input == "empty" >  puts "no input" > else >  puts input > end > > all i want it to do is wait like 10 seconds and if there has bin no user > input it should just continue with input= "empty" > > i feel like i'm missing something real simple Timeout is in the standard lib: require 'timeout' begin answer = Timeout::timeout(5) do gets end rescue Timeout::Error answer = "empty" end puts answer Jesus.