if !some_value
do_something
end
you often don't actually want it to be executed when some_value is nil instead of false. And when it is, you go scratching your head and searching where some_value came from, to discover some silly typo.In some ways, the reverse is even worse: when you write
if some_value
do_something
end
and you change some_value from nil to some sensible default like '', you will forget to update this clause and you will not understand why the code is being executed. If you use if !some_value.nil?
do_something
end
you don't have that problem, because the nil-test sticks out like a sore thumb.