Jump to content

Boolean values: Difference between revisions

(add JavaScript)
(→‎{{header|Perl}}: Expanded.)
Line 183:
 
=={{header|Perl}}==
The values in Perl that are false are: <tt>0</tt> (as a number (including <tt>0.0</tt>), or as the string <tt>'0'</tt>, but '''not''' the string <tt>"'0.0"'</tt>), the empty string <tt>""<nowiki>''</nowiki></tt>, the empty list <tt>()</tt>, and <tt>undef</tt>. Everything else is true. See [http://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood perlsyn].
 
Objects may break these rules at will via [http://perldoc.perl.org/overload.html#*-_Boolean%2c-string-and-numeric-conversion_ overloading].
Everything else is true.
 
Perl has no builtin "true" or "false" keywords. However, as a special case, literal <tt>1</tt>s and <tt>0</tt>s will never cause a "Useless use of a constant in void context" warning. Another special case worth pointing out here is that the string <tt>'0 but true'</tt> won't provoke a warning if it's used as a number.
Perl has no special "true" or "false" keywords.
[http://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood]
 
=={{header|PHP}}==
845

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.