BitAnd

Performs a bitwise logical AND operation.

Method Signature

BitAnd(number1=[integer], number2=[integer])

Arguments

Argument
Type
Required
Description
Default

number1

integer

true

Numeric value for bitwise AND.

number2

integer

true

Numeric value for bitwise AND.

Examples

Calculate bitwise logical AND

Uses the bitAnd function to perform the logical AND operation on each pair of the corresponding bits, by multiplying them

Run Example

bitAnd( 5, 3 );

Result: 1

Additional Examples

Run Example

inputValue1 = 5;
inputValue2 = 255;
writeOutput( bitAnd( inputValue1, inputValue2 ) );
writeOutput( "<br>" );
inputValue1 = 5;
inputValue2 = 0;
writeOutput( bitAnd( inputValue1, inputValue2 ) );

Last updated

Was this helpful?