&&
is the infix boolean "and" operator
||
is the infix boolean "or" operator
The infix operators are what most programmers would be familiar with because those operators get used in nearly every programming language out there.
In the end, they do the same thing as the AND()
and OR()
functions. You can freely convert between them, but the general advice is to choose one approach (functions or operators) and stick with it. Whichever one you choose is mostly down to personal preference.
e.g.
AND(
condition1,
condition2,
condition3,
condition4
)
is exactly the same as
condition1 && condition2 && condition3 && condition4
Personally, I prefer using the boolean functions because it's less typing (once you get 3 or 4 conditions you're checking) and I find it easier to group and compose functions together.
e.g.
AND(
condition1,
condition2,
OR(
condition3,
NOT(condition4)
)
)
compared to
(
condition1 && condition2
)
/* This right here is the issue I have with using the infix operators */
/* It's not obvious why this should be && */
/* It's easy to mess up, and hard(er) to identify if it is wrong */
&&
(
condition3 || !condition4
)
granted, that's a rather contrived example.
&&
and||
mean?