I understand the difference between &&
and &
, and ||
and |
. But what about |
and &
, don't they do the same thing?
I mean, won't these two if
be statements the same?
if (a | !b)
//Code here
if (a & !b)
//Code here
||
says only if boolean 1 is false
, then try boolean 2.
&&
says only if boolean 1 is true
, then try boolean 2.
However, according my information,:
&
says even if boolean 1 is false
or true
, evaluate the next statement.
|
says even if boolean 1 is false
or true
, evaluate the next statement.
Am I incorrect? If not, are there any other differences between &
and |
? All I've found by research was the difference between &&
and ||
and I couldn't find anything else.