What's wrong with unless? In fact, in this case, you just need:

````ruby
unless res
  # do something if res isn't defined
else
  # do something if res is defined
end
````

The only reason to use `nil?` is if you want to tell the difference between `NilClass` and `FalseClass`. In Ruby, `NilClass` is falsey.