Hello World

Be Happy!

Ruby null check method




nil.nil?           # => true
"".nil?            # => false
[].nil?            # => false

nil.blank?         # => true
"".blank?          # => true
"   ".blank?       # => true
[].blank?          # => true
{}.blank?          # => true
"hello".blank?     # => false

nil.present?       # => false
"".present?        # => false
"   ".present?     # => false
[].present?        # => false
"hello".present?   # => true
[1,2,3].present?   # => true

# nil.empty?       # => NoMethodError
"".empty?          # => true
[].empty?          # => true
{}.empty?          # => true
"hello".empty?     # => false

if nil             # => doesn't enter block
if ""              # => enters block (empty string is truthy in Ruby)
if false           # => doesn't enter block
#ruby (16) #rails (40) #null (1)
List