From: Marcin Raczkowski Date: 2007-04-11T18:50:45+09:00 Subject: Re: Newbe - strange behavior of print On Wednesday 11 April 2007 09:25, caof2005 wrote: > On Apr 11, 3:36 am, Bj�rn Paetzel wrote: > > caof2005 schrieb: > > > > Flush your buffers: > > > def main > > > print "Enter the number of employees: " > > > > $stdout.flush # <- here > > > > > numEmp = gets > > > puts "The number of employees is:= " + numEmp.to_s > > > end > > > > That should help. :) > > Bjorn: > > Thanks it worked great! > However is it possible you can explain me in general terms why this > behavior happens? > I mean, besides trying in EasyEclipse and SciTE I tried the same code > in irb, and surprisingly it works perfectly (no need to flush)! > > Regards Irb have Readline support and also automatically flushes everything - just in case :] by deafault print don't flush - if you want flushing - use puts