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