From: gu Date: 2007-09-01T18:20:06+09:00 Subject: Re: keyboard input: one character Michael Linfield ha scritto: > Michael Linfield wrote: >>> while true >>> info = gets.chomp >>> if info != nil >>> puts info >>> end >>> end >>> >>> actually doesn't outputs a thing.. >> lol. i didnt mean for it to be used in a while loop. > > And i actually just got home and tested that while loop, it works...ur > not doing this in IRB right? > > testprog.rb >>> while true >>> info = gets.chomp >>> if info != nil >>> puts info >>> end >>> end > > ruby testprog.rb > > output: > h > h > i > i > p > p > #whatever letter you enter it will respond with that letter that you > entered. no, i'm not using irb. maybe there's an os compatibility problem going on? i'm testin it in windows xp sp2..