How can I clear the terminal in Ruby?

前端 未结 15 1675
心在旅途
心在旅途 2020-11-30 06:14

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

puts \"amit\"
system(\"clear\")
         


        
15条回答
  •  無奈伤痛
    2020-11-30 07:00

    For windows users:

    Just type this below function in your irb window and you are good to go:

    Define this function:

    def cls
      system('cls')
    end
    

    After defining call this function whenever required.

提交回复
热议问题