Boolean values: Difference between revisions
Content added Content deleted
(Added Neko) |
(Expanded details about boolean values with examples, and included a brief mention about `yes` and `no` AppleScript constants.) |
||
Line 112: | Line 112: | ||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |
||
AppleScript has built-in boolean keywords <code>true</code> and <code>false</code>. Numbers do not work in place of boolean expressions. |
AppleScript has built-in boolean keywords <code>true</code> and <code>false</code>. Numbers do not work in place of boolean expressions, but they do coerce to and from. |
||
<lang AppleScript>1 > 2 --> false |
|||
not false --> true |
|||
{true as integer, false as integer, 1 as boolean, 0 as boolean} |
|||
--> {1, 0, true, false} |
|||
true = 1 --> false</lang> |
|||
AppleScript also has constants <code>yes</code> and <code>no</code>, which coerce easily to boolean values, and are interchangeable with them in AppleScriptObjC. |
|||
<lang AppleScript>{yes as boolean, no as boolean} |
|||
--> {true, false}</lang> |
|||
However, <code>yes</code> and <code>no</code> do not coerce to integer values. |
|||
=={{header|Applesoft BASIC}}== |
=={{header|Applesoft BASIC}}== |