10
10

More than 5 years have passed since last update.

Rubyでコンソール上で進捗を表示する(ときはputsじゃなくてprintって話)

Last updated at Posted at 2015-07-31

地味に30秒くらいハマったので、メモ。

最初putsでやっていて、当然自動で改行されるのでキャリッジリターンする意味がなかった。

(1..10).each {|percent| print "\r#{percent*10}% complete";sleep(0.5)}

gif

こういうのよく見るので、カジュアルにできると便利。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10