In Ruby (unlike Objective-C) nil and zero are different.
Here’s how to tell them apart:
unless var.nil? || var == 0
# …
end
http://stackoverflow.com/questions/252203/checking-if-a-variable-is-not-nil-and-not-zero-in-ruby
In Ruby (unlike Objective-C) nil and zero are different.
Here’s how to tell them apart:
unless var.nil? || var == 0
# …
end
http://stackoverflow.com/questions/252203/checking-if-a-variable-is-not-nil-and-not-zero-in-ruby