What evaluates to false in Ruby?

前端 未结 4 1548
逝去的感伤
逝去的感伤 2020-11-30 13:37

false and nil evaluate to false in Ruby. Anything else? Please provide links to official/authoritative references.

4条回答
  •  执笔经年
    2020-11-30 14:10

    false and nil are the only ones:

    http://www.ruby-doc.org/core-2.1.1/FalseClass.html

    Rails provides present? which also includes empty strings and empty arrays: http://api.rubyonrails.org/classes/Object.html#method-i-present-3F

提交回复
热议问题