Mathematica is a symbolic language. In practice, this often means that you can write expressions that cannot be immediately computed without triggering any errors.
In other languages
x+1 makes no sense if
x has no numerical value. In Mathematica
x+1 simply stays unevaluated until
x gets a value.
This applies to
== as well. In
b are considered mathematical variables. It can't be decided whether
False until you give explicit values to
All this means that you must be careful when using constructs that expect a
False value. You could accidentally be passing in a value that is neither
False and still not trigger an error, the same way as
x+1 does not trigger an error despite
x not having a value. Different constructs behave differently in this situation, but the two typical approaches are:
Treat anything that isn't
False. This is the case with
Condition and explains your results.
Sin != Tan is not
True. It just stays unevaluated, therefore it is treated as
Simply do not evaluate. This is the case e.g. with
If[x == y, 1, 2]
(* If[x == y, 1, 2] *)
If in fact has a fourth argument which lets you explicitly handle values that are neither true nor false.
Other approaches to deal with this consequence of the symbolic nature of the language is to have functions which always evaluate to
False, no matter what their argument. Functions with names ending in
Q are almost always like this.
=== is called
SameQ, and it always evaluates.
DirectedGraphQ also always evaluates: if you pass in a non-graph value, it returns
False (you can think of it like this: something that is not a graph cannot be a directed graph). A very common mistake is to assume that some functions stay unevaluated in the same way as
x+1 when in fact they don't, e.g.
OddQ[x] immediately evaluate to
x has no value.
There is also a function,
TrueQ, that serves to explicitly convert anything not