User Guide

244 Chapter 12: Methods
bitNot()
Usage
(integer).bitNot
bitNot(integer)
Description
Function (Lingo only); converts the specified integer to a 32-bit binary number and reverses the
value of each binary digit, replacing 1’s with 0’s and 0’s with 1’s. The result is the new binary
number, which Lingo displays as a base 10 integer.
In JavaScript syntax, use the bitwise operator "
~".
Parameters
None.
Example
This statement inverts the binary representation of the integer 1 and returns a new number.
put (1).bitNot
-- -2
See also
bitAnd(), bitOr(), bitXor()
bitOr()
Usage
bitOr(integer1, integer2)
Description
Function (Lingo only); converts the two specified integers to 32-bit binary numbers and returns a
binary number whose digits are 1’s in the positions where either number had a 1, and 0’s in every
other position. The result is the new binary number, which Lingo displays as a base 10 integer.
In JavaScript syntax, use the bitwise operator "
|".
Integer Binary number
1 00000000000000000000000000000001
Result
-2 11111111111111111111111111111110
Integer Binary number (abbreviated)
50101
60110
Result
70111