Boolean values: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add PL/M) |
|||
Line 1,970: | Line 1,970: | ||
<pre>That's true |
<pre>That's true |
||
false was recognized</pre> |
false was recognized</pre> |
||
=={{header|PL/M}}== |
|||
In PL/M, even numbers are falsy and odd numbers are truthy. That is to say, conditional expressions test only the low bit of the value. |
|||
<lang pli>IF 0 THEN /* THIS WON'T RUN */; |
|||
IF 1 THEN /* THIS WILL */; |
|||
IF 2 THEN /* THIS WON'T */; |
|||
IF 3 THEN /* THIS WILL */;</lang> |
|||
Canonically, false is represented by <code>0</code> (all bits clear), and true by <code>0FFH</code> (all bits set). These are the values that conditional operators (like <code>=</code>) return. |
|||
<lang pli>DECLARE A BYTE; |
|||
A = 4 < 5; |
|||
/* A IS NOW 0FFH */</lang> |
|||
Boolean literals are not included by default, but it is not uncommon for programmers to define them by hand: |
|||
<lang pli>DECLARE FALSE LITERALLY '0', TRUE LITERALLY '0FFH';</lang> |
|||
=={{header|Plain English}}== |
=={{header|Plain English}}== |