Assignment by bitwise OR

From Microduino Wiki
Jump to: navigation, search

=|(Compound bitwise or)

Description
Compound bitwise is represented by "|=", which is used to set one bit of a variable or a constant as 0 or 1.


Syntax

x |= y;       // equal to x = x | y; 


Parameters
x: char, int, or long int variable y: char, int, or long int constant


Example
Look at the usage of bitwise or(|) firstly.

    0  0  1  1    operand 1
    0  1  0  1    operand 2
    ----------
    0  1  1  1    (operand 1 & operand 2) - Returned value

[Return to Arduino Syntax Manual]