MATLAB: “OR” not working

MATLABor

Hi,
I am seeing a strange result in matlab using the OR operator.
This is what I am seeing:
K>> 5==1|2
ans =
1
I must be doing something wrong, but can't figure out what. Any ideas?

Best Answer

This is correct
5==1
The result is 0
0|2
the result is 1