How to print something without a new line in ruby

前端 未结 3 1046
南笙
南笙 2021-02-04 23:07

puts statement in ruby automatically adds a new line, how do I avoid it?

3条回答
  •  逝去的感伤
    2021-02-04 23:38

    $stdout.sync = true
    
    100.times do
        print "."
        sleep 1
    end
    

    "How can I use “puts” to the console without a line break in ruby on rails?"

提交回复
热议问题