How can I clear the terminal in Ruby?

前端 未结 15 1706
心在旅途
心在旅途 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:51

    If you want something that is vaguely portable you can try:

    system "clear" || system "cls"
    

    which will try both clear and cls

提交回复
热议问题