Created
August 16, 2016 22:54
-
-
Save JoshCheek/ffb8b3612710d6e0e7976b94c08ed631 to your computer and use it in GitHub Desktop.
Syntactic Nilmare
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
# be sure to use 2.3.0, b/c it uses the new "safe navigation" operator | |
RUBY_VERSION # => "2.3.0" | |
def show(arg) | |
arg # => true, {:nil=>:nil?}, {:nil=>false} | |
end # => :show | |
nil # => nil | |
nil.nil? # => true | |
nil&.nil # => nil | |
nil&nil # => false | |
nil?.nil? # => false | |
nil?&nil? # => false | |
nil?&%?nil? # => false | |
nil&:nil # => false | |
nil&:nil? # => false | |
nil&.&nil? # => nil | |
nil&.&nil # => nil | |
nil&.|nil # => nil | |
nil&.& &:nil? # => nil | |
nil&&nil # => nil | |
nil&&nil? # => nil | |
nil&&:nil # => nil | |
nil&&:nil? # => nil | |
show nil::nil? # => true | |
show nil: :nil? # => {:nil=>:nil?} | |
show nil:nil? # => {:nil=>false} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment