Use logic operators in If statement: Not, And, Or : Logical operators « Operator « VB.Net Tutorial






Module Module1

    Sub Main()
        Dim A As Boolean = False
        Dim B As Boolean = True
        Dim C As Boolean = True

        If (Not A) Then
            Console.WriteLine("Not A")
        End If

        If (B Or C) Then
            Console.WriteLine("B Or C")
        End If

        If (B And C) Then
            Console.WriteLine("B And C")
        End If

    End Sub

End Module
Not A
B Or C
B And C








3.3.Logical operators
3.3.1.Logical operator: AndAlso
3.3.2.Logical operator: OrElse
3.3.3.Logical operator: And
3.3.4.Logical operator: Or
3.3.5.Logical operator: Xor
3.3.6.Logical operator: Not
3.3.7.Use Logic operator Or to link two functions
3.3.8.Use logic operators in If statement: Not, And, Or