A description of the logic of Judgment in VB

Source: Internet
Author: User

For example, when a continuous judgment is made, even if the first one does not meet the criteria, the latter will still be counted. It is important to remember that unless all of your functions are necessary, it will result in less efficiency.

Code reduction does not necessarily improve efficiency, for IIF and continuous judgment, it seems that many people do not know that FUNCA,FUNCB,FUNCC will execute

The code below, interested can try to try or whether also like and

Option ExplicitPrivate SubCommand1_Click ()Print "Continuous Judgment------------------------"    IfFunca andFuncb andFuncc Then        Print ">>> OK"&vbCrLfElse        Print ">>> NO"&vbCrLfEnd If        Print "Nested judgment------------------------"    IfFunca Then        IfFuncb Then            IfFuncc Then                Print ">>> OK"&vbCrLfExit Sub            End If        End If    End If    Print ">>> NO"&vbCrLfPrint "IIF Judge------------------------"    If IIf(FUNCB, FUNCC, Funca) Then        Print ">>> OK"&vbCrLfElse        Print ">>> NO"&vbCrLfEnd IfEnd SubPrivate FunctionFunca () as Boolean    Print "run over Funca"Funca=FalseEnd FunctionPrivate FunctionFUNCB () as Boolean    Print "run over FUNCB"FUNCB=TrueEnd FunctionPrivate FunctionFUNCC () as Boolean    Print "run over FUNCC"FUNCC=TrueEnd Function

A description of the logic of judgment in VB

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.