Clear the 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. :slight_smile:

Love U Ruby wrote:

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?

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.