Skip to content

Instantly share code, notes, and snippets.

@hatappo
Created April 8, 2015 09:54
Show Gist options
  • Save hatappo/9c2fbfb3648ba9828f20 to your computer and use it in GitHub Desktop.
Save hatappo/9c2fbfb3648ba9828f20 to your computer and use it in GitHub Desktop.
Rubyで引数のないメソッドを呼び出す際はも () を付けたほうが良い?
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
@hatappo
Copy link
Author

hatappo commented Apr 8, 2015

例えば to_s()

例えば nil?()empty?()
末日が? は変数名に使えないから、括弧いらないかな。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment