That is the way it should be!
Quote from wikipedia : the logical conjunction (a.k.a. &&
) "results in true if both of its operands are true, otherwise the value of false."
In other words, if the first operand is false, there is no need to proceed with the evaluation of the second one because the result will always be false.
So an expression like
if(condition1 && condition2)
is equivalent to
if(condition1){
if(condition2){
}
}
So you see that if the first condition is false, there is no need to continue evaluating your expression, because the answer will be unchanged.