The data type of the variable does make a difference as to what you could do with the if
statement.
Boolean
If they are boolean
values and you want to know when they are one, you can go:
if(aa && bb && cc) { }
Because each variable is either one or zero, if one of them were false then the whole statement would be false. Only, when all are one will this statement be true.
Integer
If you want to have the look of
if((aa && bb && cc) == Value) {}
You can multiply them and see if they are equal to the cube of Value
.
if(aa*bb*cc == Value*Value*Value) {}
So, if Value
equals one then you get:
if(aa*bb*cc == 1) {}
Best Way
The best way to do this would be to individually check that each variable is equal to Value
.
if(aa == Value && bb == Value && cc == Value) {}
This is because the &&
operator expects two bool
s then returns a boolean
value. So, when you go aa && bb && cc
you are literally "anding" these values together to produce a boolean
value. By first comparing each variable to the Value
you are creating a boolean
value for each one then "anding" that together to produce a similar result as the first solution I presented.
Hope this helps!