Anonymous user
Boolean values: Difference between revisions
Expanded answer to include examples, and some information about other boolean-like quantities.
(Expanded details about boolean values with examples, and included a brief mention about `yes` and `no` AppleScript constants.) |
(Expanded answer to include examples, and some information about other boolean-like quantities.) |
||
Line 122:
true = 1 --> false</lang>
AppleScript also has constants <code>yes</code> and <code>no</code>, which coerce easily to boolean values
<lang AppleScript>{yes as boolean, no as boolean}
--> {true, false}</lang>
Finally, AppleScript also includes keywords <code>with</code> and <code>without</code>, used in declaring parameters for and sending parameters of boolean nature to handlers. They are synonymous with <code>true</code> and <code>false</code>, respectively, and the compiler will sometimes perform the substitution at compile time.
<lang AppleScript>sortItems from L given reversal : true</lang>
gets compiled immediately to become:
<lang AppleScript>sortItems from L with reversal</lang>
However, the equivalent call to the handler utilising <code>yes</code>, whilst accepted readily in place of its boolean counterpart, is left alone by the compiler:
<lang AppleScript>sortItems from L given reversal:yes</lang>
=={{header|Applesoft BASIC}}==
|