LoginSignup
0
0

More than 5 years have passed since last update.

真偽を表すメソッド名には末尾に「?」をつける

Posted at

真偽値を表すメソッド

真偽値を表すメソッドは、Rubyではメソッド名の末尾に?をつける。
こうすることで、オブジェクトに対して状態を問い合わせるというメソッド呼び出しが自然な形になります。

def enjoy?
  true
end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0