Created
May 27, 2013 15:06
-
-
Save lucassmagal/5657543 to your computer and use it in GitHub Desktop.
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
def a | |
2 | |
end | |
b = 3 | |
a +b # ERROR! | |
a + b # 5 | |
# 1.9.3-p194 :001 > def a | |
# 1.9.3-p194 :002?> 2 | |
# 1.9.3-p194 :003?> end | |
# => nil | |
# 1.9.3-p194 :004 > b = 3 | |
# => 3 | |
# 1.9.3-p194 :005 > a +b | |
# ArgumentError: wrong number of arguments (1 for 0) | |
# from (irb):1:in `a' | |
# from (irb):5 | |
# from /home/lmagalhaes/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>' | |
# 1.9.3-p194 :006 > a + b | |
# => 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isso acontece porque o whitespace funciona como um alias para o ponto, que é um alias para o método send
Ou seja:
a aqui é considerado um objeto porque retorna um FixNum
Quando você junta os dois, acontece isso: