C:>irb --simple-prompt
DL is deprecated, please use Fiddle
STDIN.gets
I am
=> “I am\n”
Now how to print and clear the content of STDIN?
C:>irb --simple-prompt
DL is deprecated, please use Fiddle
STDIN.gets
I am
=> “I am\n”
Now how to print and clear the content of STDIN?
The simple answer is you should never need to do this. So don’t.
Don’t take the bait dude.
Love U Ruby wrote:
C:>irb --simple-prompt
DL is deprecated, please use FiddleSTDIN.gets
I am
=> “I am\n”Now how to print and clear the content of STDIN?
If you are using short programs where you request something from STDIN
then want to do a bit of processing then have it print out without
waiting for some other event do this:
$stdout.sync = true
a = gets.chomp
# process a
print "#{a} /n"
Tom R.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs