Logical operands test the true/false status of variables, Bitwise operands test the true/false status of individual bits within a variable (eg: check to see if they're set to 1 or 0).
Examples (Jscript):
// Example 1 - Bitwise AND
// See if number's 3rd bit (from right) is set
// (test against the value of the 3rd bit (4))
var number = 13; (00001101 in binary)
if ( number & 4 ) {
// yep (result: 00000100)
Ball.scaleZ = number;
} else {
// nope (result: 00000000)
Ball.scaleZ = 0;
}
// Example 2 - Bitwise OR
// See if either variable has set bits
var n1 = 32; (00100000 in binary)
var n2 = 13; (00001101 in binary)
var result = n1 | n2; (result: 00101101)
Ball.scaleZ = ( result == n2 + n1 ? result : 0 );
// Example 3 - Bitwise XOR
// Find unique bits between variables
var n1 = 13; (00001101 in binary)
var n2 = 4; (00000100 in binary)
var result = n1 ^ n2; (result: 00001001)
Ball.scaleZ = ( result ? result : 0 );