Introduction to VB. NET: andalso and OrElse for AND, OR, andalsoorelse
Module Module1
Sub Main ()
Dim x As Integer = 8, y As Integer = 5, z As Integer = 3
Console. WriteLine ("x = {0}, y = {1}, z = {2}", x, y, z)
Console. WriteLine ("x> y ANDALSO y> z = {0}", x> y AndAlso y> z)
Console. WriteLine ("y> x andalso y> Z = {0}", y> x AndAlso y> z)
Console. WriteLine ("X> andalso z> Y = {0}", x> y AndAlso z> y)
Console. WriteLine ("x> y ORELSE y> z = {0}", x> y OrElse y> z)
Console. WriteLine ("y> x orelse y> Z = {0}", y> x OrElse y> z)
Console. WriteLine ("X> orelse z> Y = {0}", x> y OrElse z> y)
Console. WriteLine ("the difference between AndALso and is that if the first expression is False, False will be returned and will not be computed. This improves the efficiency ")
Console. WriteLine ("the difference between OrElse and Or is that if the first expression is True, TRue is returned and is not counted. This improves the efficiency ")
Console. ReadKey ()
End Sub
End Module