Use Logic operator Or to link two functions : Logical operators « Operator « VB.Net Tutorial






Module LogicTest

    Sub Main()
        Dim x As Integer = 1
        Dim y As Integer = 1
        If A(x) Or B(y) Then
            Console.WriteLine("x= " & CStr(x) & ", y = " & CStr(y))
        End If
        If A(x) OrElse B(y) Then
            Console.WriteLine("x= " & CStr(x) & ", y = " & CStr(y))
        End If
    End Sub

    Function A(ByVal v1 As Integer) As Boolean
        Return True
    End Function

    Function B(ByVal v1 As Integer) As Boolean
        Return True
    End Function

End Module
x= 1, y = 1
x= 1, y = 1








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