February 2019
Intermediate to advanced
626 pages
15h 51m
English
The result of -band is a number where each of the bits in both the value on the left and the value on the right is set.
In the following example, the result is 2:
11 -band 6
This operation can be shown in a table:
|
Bit value |
8 |
4 |
2 |
1 |
|
|
Left-hand side |
11 |
1 |
0 |
1 |
1 |
|
Right-hand side |
6 |
0 |
1 |
1 |
0 |
|
-band |
2 |
0 |
0 |
1 |
0 |
The result is a number where both the left-hand side and right-hand side include the bit.
Read now
Unlock full access