LoginSignup
1
1

More than 3 years have passed since last update.

rubyで1文字ずつ表示する

Last updated at Posted at 2019-11-16

下の、motoの値を書き換えるだけなので、簡単です。
前回出した、musicplayerの作り方などの記事でも使っていたのですが、説明を忘れていました。

ruby
        moto = "テスト\n" #これは、テストと表示するプログラムです。
        string = moto
        loop do
        print string.chr
        moto = string.chr
        string.sub!(/#{moto}/,'')
        if string.size == 0
        break
        end
        sleep 0.1
        end        
1
1
1

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
1
1