how to write a condition for all elements of a list
You could also try AllTrue
:
If[AllTrue[a, # == yes &], Print["that's OK"]]
Not sure what you're trying to do, but for your specific example, the following works:
If[Union@a == {yes}, Print["that's OK"]]
An even more expressive approach (in my opinion at least) is to use ContainsOnly
:
If[ContainsOnly[{yes}]@a, Print["that's OK"]];
(* that's OK *)