Created
September 30, 2016 11:18
-
-
Save nunosilva800/7696d30659b7ec22920008bc9d9b5381 to your computer and use it in GitHub Desktop.
Ruby equalities
This file contains 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
irb> 1 == 1.0 | |
=> true # generic equality | |
irb> 1 === 1.0 | |
=> true # case equality | |
irb> 1.eql? 1.0 | |
=> false # equality by value | |
irb> 1.equal? 1.0 | |
=> false # object identity | |
irb> 'a'.eql? 'a' | |
=> true # equality by value | |
irb> 'a'.equal? 'a' | |
=> false # object equality |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://youtu.be/-oorcRJ2Kfg?t=770