Tuesday, April 12, 2016

nil? Vs empty? Vs blank? Vs present? Vs any?


  • blank? objects are false, empty, or a whitespace string. For example, "", " ", nil, [], and {} are blank.

  • nil? objects are instances of NilClass.

  • empty? objects are class-specific, and the definition varies from class to class. A string is empty if it has no characters, and an array is empty if it contains no items.
enter image description here

No comments:

Post a Comment