# What's wrong with or? [closed]

Consider

Clear[x];
x = 2;
x < 2.9 || x > 3.1


This yields

True


So, everything is o. k. (interesting) But when you replace || by or, the result becomes really interesting:

Clear[x];
x = 2;
x < 2.9 or x > 3.1


yields

2 < 5.8 or && 5.8 or > 3.1


What the heck is going on? I presume that the following is happening:

1. or is different from OR (that is, from ||), since Mathematica is case-sensitive.
2. Thus, or is an other operator, perhaps a bitwise or or something like this???

I am interested in how exactly the strange value is generated. That is, if or is a bitwise operation, how do the left and right sides look "in bits" and how does or work on these bits? Any help is greatly appreciated.

• The command is Or; your or is an undefined variable, as so humorously pointed out below. Aug 11 at 13:00
• Either Or[x < 2.9, x > 3.1] or (x < 2.9) ~Or~ (x > 3.1) Aug 11 at 14:09

Since or is an as yet undefined symbol, the input

2.9 or x


is interpreted as the product of these three things, and evaluates to

5.8*or


in your case since you set x=2 before.

Accordingly, if you input

x < 2.9 or x > 3.1


this evaluates to

2 < 5.8*or > 3.1


But a chain of inequalities such as a < b > c is always rewritten as And[a<b,b>c], therefore you get

And[2 < 5.8*or, 5.8*or > 3.1]


respectively the equivalent short form using &&.