Binary and
Appearance
hello Likewise, two bits may be combined with and:
x | y | x AND y |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
I.e. the result is 1, if both x and y are 1, and 0 otherwise. If 0 is equated with false, and 1 with true the bit and operation works like our logical and.