## rails console # nil nil.nil? #=> true "".nil? #=> false " ".nil? #=> false 0.nil? #=> false true.nil? #=> false false.nil? #=> false [].nil? #=> false {}.nil? #=> false # empty "".empty? #=> true " ".empty? #=> false [].empty? #=> true nil == empty #=> false nil.empty? #=> error 0.empty? #=> error true.empty? #=> error false.empty? #=> error {}.empty #=> error # blank nil.blank? #=> true "".blank? #=> true " ".blank? #=> true 0.blank? #=> false true.blank? #=> false false.blank? #=> true [].blank? #=> true {}.blank? #=> true
参考サイト