Boolean values: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with '{{task|Basic language learning}} What values are true and false? =={{header|Ruby}}== The only values in Ruby that are false are: <code>false</code> and <code>nil</code>. They h…')
 
Line 3: Line 3:


=={{header|Ruby}}==
=={{header|Ruby}}==
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>
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 (including the constants <code>true</code> and <code>TRUE</code>) is true.
Everything else (including the number <code>0</code> and the empty string) is true. Constants <code>true</code> (and <code>TRUE</code>) exist.

Revision as of 17:53, 10 July 2009

Task
Boolean values
You are encouraged to solve this task according to the task description, using any language you may know.

What values are true and false?

Ruby

The only values in Ruby that are false are: false and nil. They have synonyms FALSE and NIL.

Everything else (including the number 0 and the empty string) is true. Constants true (and TRUE) exist.