Boolean values: Difference between revisions

No edit summary
Line 404:
The only values in Ruby that are false are: <code>false</code> and <code>nil</code>. They have synonyms <code>FALSE</code> and <code>NIL</code>.
 
Everything else is true. Constants <code>true</code> (includingand <code>TRUE</code>) exist. Note for Python and Perl users: unlike Python, in Ruby, the number <code>0</code>, the empty string, the empty array, and the empty string)hash, isetc. are all true.; you Constantscan instead use the <code>truezero?</code> (method to test for 0, and the <code>TRUE.empty?</code>) existmethod to test for an empty sequence.
 
<code>false</code>, <code>nil</code> and <code>true</code> are singleton instances of classes <code>FalseClass</code>, <code>NilClass</code> and <code>TrueClass</code> respectively.
Anonymous user