Boolean values: Difference between revisions

no edit summary
m (→‎Perl: removed example of deprecated code)
No edit summary
Line 1,070:
 
In an <code>if</code> and similar, <code>nil</code> is false and anything else is true. To make that clear docstrings etc say "non-nil" for true. (See last item in [http://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation-Tips.html elisp manual documentation tips].)
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
logic booleanTrue = true
logic booleanFalse = false
if 2 > 1 and true and not false
writeLine("true: " + true + ", false: " + false)
end
if false == logic!0
writeLine("explicit conversion from integer")
end
if true == logic!"⊤"
writeLine("explicit conversion from text")
end
</syntaxhighlight>
{{out}}
<pre>
true: ⊤, false: ⊥
explicit conversion from integer
explicit conversion from text
</pre>
 
=={{header|Erlang}}==
Erlang doesn't technically define boolean types. Instead, the atoms <tt>true</tt> and <tt>false</tt> are used. However, they are integrated well enough into the language there should be no problem with that as long as you don't expect false and true to mean anything but literal false and true.
223

edits