1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

R9.org

Last updated at Posted at 2020-12-23

!Mac OS X-10.15.7 !ruby-2.7.1p83

第9回

チャート式Rubyの第4回目

assert_equal

require 'colorize'

def assert_equal(expected, result)
  if expected == result
    puts 'true'.blue
  else
    puts 'false'.red
  end
end

assert_equal(1, 1)
assert_equal(1, 2)

上記のコードを実行してみた

true
false

colorizeしたため結果として(1,1)のとき青文字でtrue(1,2)のとき赤文字でfalseと出力された。

rubular

正規表現を使用して文字情報を取り出せるらしい。テスト文字列

#+qiita_id : daddygongon

正規表現として(.+)と入力すると

#+qiita_id : daddygongon

と出力され取り出すことが出来る。

参考サイト

assert_equal

rubular


  • source ~/grad_members_20f/members/skona/memo/R9.org
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?