How can I clear the terminal in Ruby?

前端 未结 15 1685
心在旅途
心在旅途 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 06:55

    Here is a multiplatform way to do it:

    Gem.win_platform? ? (system "cls") : (system "clear")
    

提交回复
热议问题