Are they the same when used in an if/else/end statement? What do you usually do? I\'m wondering if there are any subtle differences or edge cases where ob
if/else/end
ob
There are differences. For example:
false.nil? # => false
So:
if !false.nil? 'foo' end # => "foo" if false 'foo' end # => nil
As @tokland suggested, in most cases using !obj.nil? construction is unnecessary.
!obj.nil?