From: eckhardt.f@... Date: 2007-09-24T04:25:08+09:00 Subject: Re: keyboard input: one character On Sep 1, 11:01 am, Michael Linfield wrote: > 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. > -- > Posted viahttp://www.ruby-forum.com/. Hi, I think gu means to get one character without pressing enter afterwards. Just like "readkey" in Pascal. As I know this is actually only possible with Ruby on MS Windows with (Win32API.new("crtdll", "_getch", [], "L").Call).chr Bye