User Guide
bitAnd() 243
// JavaScript syntax
function animBall(numberOfFrames) {
_movie.beginRecording();
var horizontal = 0;
var vertical = 100;
for (var i = 1; i <= numberOfFrames; i++) {
_movie.go(1);
sprite(20).member = member("Ball");
sprite(20).locH = horizontal;
sprite(20).locV = vertical;
sprite(20).foreColor = 255;
horizontal = horizontal + 3;
vertical = vertical + 2;
_movie.updateFrame();
}
_movie.endRecording();
}
See also
endRecording(), Movie
bitAnd()
Usage
bitAnd(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 both numbers 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 "
&".
Parameters
integer1
Required. The first integer.
integer2 Required. The second integer.
Example
This statement compares the binary versions of the integers 6 and 7 and returns the result as an
integer:
put bitAnd(6, 7)
-- 6
See also
bitNot(), bitOr(), bitXor()
Integer Binary number (abbreviated)
6 00110
7 00111
Result
6 00110