Jump to content

Boolean values: Difference between revisions

Logo
(Logo)
Line 68:
=={{header|Java}}==
Java has <tt>true</tt> and <tt>false</tt> keywords, representing the only values of type <tt>boolean</tt>. There are also object wrappers <tt>Boolean.TRUE</tt> and <tt>Boolean.FALSE</tt>, of type <tt>Boolean</tt> which may be un-boxed into <tt>boolean</tt>s (auto-unboxed in Java 1.5+). There are no automatic conversions from any other types into <tt>boolean</tt>, and it is a compile-time error to use any type other than <tt>boolean</tt> or <tt>Boolean</tt> in a place that expects a <tt>boolean</tt> (e.g. if-statement condition, while-statement condition, operand of a logical operator, etc.).
 
=={{header|Logo}}==
Logo has predefined symbols for true and false ("true and "false), which are the values returned by predicates and required by logical operators and conditionals.
<lang logo>
print 1 < 0 ; false
print 1 > 0 ; true
if "true [print "yes] ; yes
if not "false [print "no] ; no
</lang>
 
=={{header|Perl}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.