Created
April 8, 2015 09:54
-
-
Save hatappo/9c2fbfb3648ba9828f20 to your computer and use it in GitHub Desktop.
Rubyで引数のないメソッドを呼び出す際はも () を付けたほうが良い?
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(main):031:0> foo = 111 | |
=> 111 | |
irb(main):032:0> def foo() 222 end | |
=> :foo | |
irb(main):033:0> foo | |
=> 111 | |
irb(main):034:0> foo() | |
=> 222 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
例えば
to_s()
。例えば
nil?()
、empty?()
末日が? は変数名に使えないから、括弧いらないかな。