I would like to know to how to do in Ruby what I can do with system(\"clear\") in C. I wrote a program like
system(\"clear\")
puts \"amit\" system(\"clear\")
Starting from Ruby 2.7, there is a build-in and cross-platform way to clear the terminal output:
require 'io/console' $stdout.clear_screen # or STDOUT.clear_screen
See the difference between $stdout and STDOUT here.
$stdout
STDOUT