Visual Basic .NET LanguageShort-Circuiting Operators (AndAlso - OrElse)


Syntax

  • result = expression1 AndAlso expression2
  • result = expression1 OrElse expression2

Parameters

ParameterDetails
resultRequired. Any Boolean expression. The result is the Boolean result of comparison of the two expressions.
expression1Required. Any Boolean expression.
expression2Required. Any Boolean expression.

Remarks

'AndAlso' and 'OrElse' are ShortCircuiting operators that means that the execution is shorter because the compiler doesn't evaluate all the expressions in a boolean comparision if the first one provides the desidered result.