Assignment by bitwise OR

From Microduino Wiki
Revision as of 08:37, 12 August 2016 by Fengfeng (talk) (Created page with "=|(Compound bitwise or) '''Description'''<br> Compound bitwise is represented by "|=", which is used to set one bit of a variable or a constant as 0 or 1. '''Syntax'''<br>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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]