Introduction to VB. NET: andalso and OrElse for AND, OR, andalsoorelse

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.