Marcin Raczkowski
4/11/2007 9:51:00 AM
On Wednesday 11 April 2007 09:25, caof2005 wrote:
> On Apr 11, 3:36 am, Björn Paetzel <n...@kolrabi.de> 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