I have a codebase where developers decided to use AND
and OR
instead of &&
and ||
.
I know that there is a
Another nice example using if
statements without =
assignment operations.
if (true || true && false); // is the same as:
if (true || (true && false)); // TRUE
and
if (true || true AND false); // is the same as:
if ((true || true) && false); // FALSE
because AND
has a lower precedence and thus ||
a higher precedence.
These are different in the cases of true, false, false
and true, true, false
.
See https://ideone.com/lsqovs for en elaborate example.