Last active
August 29, 2015 14:04
-
-
Save 2get/5f892fb4ccc5ca91eae4 to your computer and use it in GitHub Desktop.
Ruby ===
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p (1..5) === 3 #=> true レシーバは Range クラスのインスタンスだから、=== 演算子は引数が自身の範囲内に含まれるかを判定 | |
p 3 === (1..5) #=> false レシーバは Fixnum クラスのインスタンスだから、=== 演算子は数値として等しいかを判定 | |
p /おつかれ/ === 'おつかれさまです' #=> true レシーバは Regexp クラスのインスタンスだから、=== 演算子は引数の文字列がマッチするか判定 | |
p 'おつかれさまです' === /おつかれ/ #=> false レシーバは String クラスのインスタンスだから、=== 演算子は同値判定 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment