I love Ruby's naming conventions foo? and foo!.
foo?
foo!
The former is for a method that returns a boolean (like IsFoo in some languages):
IsFoo
irb(main):006:0> s = 'abc' => "abc" irb(main):007:0> s.empty? => false
The latter for a method that may do something possibly unexpected, such as modifying a given argument:
irb(main):001:0> s = 'abc' => "abc" irb(main):002:0> s.reverse => "cba" irb(main):003:0> s => "abc" irb(main):004:0> s.reverse! => "cba" irb(main):005:0> s => "cba"
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I love Ruby's naming conventions
foo?
andfoo!
.The former is for a method that returns a boolean (like
IsFoo
in some languages):The latter for a method that may do something possibly unexpected, such as modifying a given argument: