There is no syntax that will work in quite in the fashion of checking three variables or statements against a single outcome. It's important to note that &&
and &
as logical operators do not match all normal uses of the word AND (for instance, you could not check that boolean1 AND boolean2 AND boolean3 == false
with &&
or &
operators).
That said, evaluating boolean1 == true
will give the same result as just boolean1
. So the tedious if statement
if(boolean1 == true & boolean2 == true & boolean3 == true){...}
can be shortened to
if(boolean1 & boolean2 & boolean3){...}
It is also probably advisable to use &&
instead of &
unless you have a specific reason to avoid short-circuiting. See Differences in boolean operators: & vs && and | vs || for more on that topic.