The compound condition of logic and

Source: Internet
Author: User

The function return value is a number, a number may represent a case, or it can represent multiple case combinations. The return value rule is as follows:

Conditions Decimal number Binary number
Case1 1 1
Case2 2 10
Case3 4 100
Case4 8 1000
Case5 16 10000

The return value is incremented by reference to the binary number rule, because the sum of the sums is guaranteed to be unique, regardless of the number of conditions in which it is satisfied.

' Check for positive validity Dim II = Fncheck (iNum) If Not i = 0 thenif (i and 1) = 1 Then ' Nullend ifif (i and 2) = 2 Then ' non-numeric (character) End IfIf (I an D 4) = 4 Then ' negative end ifif (i and 8) = 8 Then ' 0 End IfEnd If ' determines if number is positive ' return value: 0-Normal, 1-null,2-non-numeric (character), 4-negative, 8-0 function Fncheck (iNu m) Fncheck = 0If IsNull (iNum) Thenfncheck = Fncheck + 1End ifif not IsNumeric (iNum) Thenfncheck = Fncheck + 2End ifif iNum < 0 Thenfncheck = Fncheck + 4End ifif iNum = 0 Thenfncheck = fncheck + 8End IfEnd Function

  

The compound condition of logic and

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.