This blog defines the logical operators in VB.NET.

Logical Operator

The logical operators compare Boolean expressions and return a Boolean result. In short, logical operators are expressions which return a true or false result over a conditional expression.

And— The And operation returns the True if both operands are True, False otherwise where you treat 0 as False and 1 as True.

Not— Reverses the logical value of its operand, from True to False and False to True, for bitwise operations, turns 0 into 1 and 1 into 0.

Or— The Or operation returns the True if either operand is True, False otherwise. where you treat 0 as False and 1 as True.

Xor— Operator performs an exclusive-Or operation True if either operand, but not both, is True, and False otherwise where you treat 0 as False and 1 as True.

AndAlso— Operator A "short circuited" And operator; if the first operand is False, the second operand is not tested.

OrElse— Operator A "short circuited" Or operator, if the first operand is True, the second is not tested.

For example

Module Module1

Dim a As Integer = 15

Dim b As Integer = 45

Dim gt As Integer

Sub Main()

If a > b And check(a) Then

End If

If a > b AndAlso check(a) Then

End If

If a < b Or check(a) Then

End If

If a < b OrElse check(a) Then

End If

End Sub

Function check(ByVal checkValue As Integer) As Boolean

If checkValue > 20 Then

MsgBox(CStr(checkValue) & " is not a valid value.")

Return False

Else

gt += checkValue

Return True

End If

End Function

End Module