T
Thomas Yager-Madden
So, still busy just getting introduced to this ruby business. For
riduculous reasons entirely my own, I decide it would neat-o to have a
programm write a line of dots on the screen (.....), but to write them
slooowly, maybe a second between each dot. Okay. So I try
25.times { print "."; sleep 1 }
print "\n"
But instead of printing a dot, waiting a second, and then printing
another dot, &c. Ruby waits 25 seconds and then prints 25 dots all at
once.
Interestingly, { puts "."; sleep 1 } shows the desired behavior of
waiting a second between each dot, but of course it puts each dot on a
separate line.
It's looking to me like Ruby gathers up print messages, and saves them
up, writing to stdout only when it encounters a newine or the end of the
program.
Anybody know how to get my idle little toy to work the way I want it to.
It would help me scratch this little itch way up on top my brain.
Thanks
Thomas
riduculous reasons entirely my own, I decide it would neat-o to have a
programm write a line of dots on the screen (.....), but to write them
slooowly, maybe a second between each dot. Okay. So I try
25.times { print "."; sleep 1 }
print "\n"
But instead of printing a dot, waiting a second, and then printing
another dot, &c. Ruby waits 25 seconds and then prints 25 dots all at
once.
Interestingly, { puts "."; sleep 1 } shows the desired behavior of
waiting a second between each dot, but of course it puts each dot on a
separate line.
It's looking to me like Ruby gathers up print messages, and saves them
up, writing to stdout only when it encounters a newine or the end of the
program.
Anybody know how to get my idle little toy to work the way I want it to.
It would help me scratch this little itch way up on top my brain.
Thanks
Thomas