Description
Performs a bitwise AND operation on two integers. Each bit in the result is 1 only if the corresponding bits in both operands are 1.Syntax
Parameters
Returns
Type: number (integer) The result of the bitwise AND operation.Examples
Example 1: Basic AND Operation
Example 2: Checking Permission Flags
Example 3: Masking Bits
Notes
- Operates on 32-bit signed integers in JavaScript
- Both operands are converted to integers if needed
- Commonly used for flag checking and bit masking
See Also
- bitwise.or - Bitwise OR operation
- bitwise.xor - Bitwise XOR operation
- bitwise.not - Bitwise NOT operation
Frequently Asked Questions
What does flex.bitwise.and return?
What does flex.bitwise.and return?
It returns an integer where each bit is 1 only if the corresponding bits in both input operands are 1. For example,
flex.bitwise.and(6, 3) returns 2.Can I use bitwise.and for permission checking?
Can I use bitwise.and for permission checking?
Yes. A common pattern is
flex.bitwise.and(userPermissions, requiredFlag) = requiredFlag to test whether a specific permission bit is set.