& operation
Arpan Chinta
4 posts
|
In the second episode (Sharing Behavior), you have this code
I’ve never used this “&” operator before. What does it do?
Could you tell me a little bit about what this operator does. In the pickaxe book you mention that it is a “Bitwise AND” (page 420) operator. I have no idea what that means. :-) |
Ian Hunter
1 post
|
&& is a logical AND, & is a bitwise operator. Let’s do some binary math (don’t look so excited) 10 & 2 is actually 00001010 For each bit, it does an AND operation (which produces 1 when both inputs are 1, 0 all other times). To answer your section portion, let’s look at the binary for 10, 11 and 12: 10: 00001010 00010100 Make sense? |
Arpan Chinta
4 posts
|
Yes, I got it. Thanks. |
3 posts, 2 voices
