Ok, so I\'ve read about this a number of times, but I\'m yet to hear a clear, easy to understand (and memorable) way to learn the difference between:
if (x |
The first, bitwise operator works on two numerical values and results in a third one.
If you have binary variables
a = 0001001b;
b = 1000010b;
then
a | b == 1001011b;
That is, a bit in the result is 1 if it is also 1 in either of the operands. (My example uses 8-bit numbers for clarity's sake)
The "double pipe" ||, is a logical OR operator that takes two boolean values and results in a third.