From: dblack@... Date: 2003-01-09T12:02:29+09:00 Subject: Re: prompt Hi -- On Thu, 9 Jan 2003, TOTO wrote: > Brennan Leathers wrote in message news:<67484A65-232D-11D7-9C75-000393C4FE10@mac.com>... > > On Wednesday, January 8, 2003, at 10:34 AM, TOTO wrote: > > > > > Is there a Ruby idiom to do prompting? For example, > > > > > > ../rm.rb: remove `t'? y > > > > also, couldn't you do this with the readline module? > > > > brennan > > gets doesn't work. I tried it at the beginning. I think the problem is > that it Reads the *next* ``line'' from the I/O stream. (So it can't > read the string following the question mark.) > > > And I thought that readline was simular to gets: Reads a line as with > IO#gets , but raises an EOFError on end of file. > > However, it turns out ok. That is quite strange. There must be something else going on with your use of gets. It should work as expected. Try running this: print "Enter a word: " w = gets puts "You typed #{w}" Or if you want to go nuts with interpolation: puts "You typed #{print "Enter a word: "; gets}" :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav