&&
and ||
are what is called "short circuiting". That means that they will not evaluate the second operand if the first operand is enough to determine the value of the expression.
For example if the first operand to &&
is false then there is no point in evaluating the second operand, since it can't change the value of the expression (false && true
and false && false
are both false). The same goes for ||
when the first operand is true.
You can read more about this here: http://en.wikipedia.org/wiki/Short-circuit_evaluation From the table on that page you can see that &&
is equivalent to AndAlso
in VB.NET, which I assume you are referring to.