Boolean values: Difference between revisions
Content added Content deleted
(added php) |
(added common lisp, scheme) |
||
Line 24: | Line 24: | ||
* any pointer type, where the null pointer gives false and any other pointer gives true |
* any pointer type, where the null pointer gives false and any other pointer gives true |
||
* any user-defined type with an implicit conversion operator either to <code>bool</code> or to a built-in type which itself can be converted to <code>bool</code> (i.e. any of the above). The C++ standard library contains one such implicit conversion: the implicit conversion of a stream <code>s</code> to <code>bool</code> gives <code>!s.fail()</code> |
* any user-defined type with an implicit conversion operator either to <code>bool</code> or to a built-in type which itself can be converted to <code>bool</code> (i.e. any of the above). The C++ standard library contains one such implicit conversion: the implicit conversion of a stream <code>s</code> to <code>bool</code> gives <code>!s.fail()</code> |
||
=={{header|Common Lisp}}== |
|||
The only value in Common Lisp that is false is <tt>nil</tt>, the empty list. |
|||
Everything else is true. The constant <tt>t</tt> represents the canonical true value. |
|||
=={{header|E}}== |
=={{header|E}}== |
||
Line 158: | Line 163: | ||
<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. |
<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. |
||
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#UF] |
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#UF] |
||
=={{header|Scheme}}== |
|||
The only value in Scheme that is false is <tt>#f</tt>. |
|||
Everything else (including the empty list, unlike Lisp) is true. The constant <tt>#t</tt> represents the canonical true value. |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |