Start with:
b = Blue; r = Red;
According to the docs, one should use Equal (==) and Unequal (!=) only for testing equality of such things as numeric objects and string objects; and one should use SameQ (===) and UnsameQ (=!=) otherwise.
So as expected, the following return unevaluated (except that the names of colors get replaced by color blobs):
Red == Blue
r == b
Red != Blue
r != b
Now, however, let:
x = b;
Now all the below do evaluate to give True or False:
x == Blue
(* True *)
x == b
(* True *)
x != Blue
(* False *)
x != b
(* False *)
Why does Mathematica permit this?
Equalto itself and is notUnequalto itself. – Bob Hanlon Apr 02 '20 at 20:16Red == Bluenot evaluate completely toTrueorFalse? – murray Apr 02 '20 at 20:50SameQare alsoEqual. (ii) Things that are notNotSameQare thusSameQare thusEqualare thus notUnequal. – Daniel Lichtblau Apr 03 '20 at 00:19