Description
Performs a bitwise OR operation on two integers. Each bit in the result is 1 if at least one of the corresponding bits in the operands is 1.Syntax
Parameters
Returns
Type: number (integer) The result of the bitwise OR operation.Examples
Example 1: Basic OR Operation
Example 2: Combining Permission Flags
Example 3: Setting Multiple Flags
Notes
- Operates on 32-bit signed integers in JavaScript
- Both operands are converted to integers if needed
- Commonly used for combining flags and setting bits
See Also
- bitwise.and - Bitwise AND operation
- bitwise.xor - Bitwise XOR operation
- bitwise.not - Bitwise NOT operation
Frequently Asked Questions
What does flex.bitwise.or return?
What does flex.bitwise.or return?
It returns an integer where each bit is 1 if the corresponding bit in either (or both) input operands is 1. For example,
flex.bitwise.or(5, 3) returns 7.How can I combine permission flags with bitwise.or?
How can I combine permission flags with bitwise.or?
Use
flex.bitwise.or(existingFlags, newFlag) to add a permission bit. For example, flex.bitwise.or(permissions, 4) sets the third bit.