All historical versions of Basic that I saw that supported bitwise logical operators with integers used the value "all-bits-set", i.e. -1 as the value for true comparisons. Thus, if you want to have a value of 9 if a == b, or zero if not, you can use the expression 9 AND (a=b)
. Although the ?:
Operator present in C allows you to more clearly encode this behavior, using -1 for "truth" has more practical advantages than disadvantages in a language without a discrete Boolean type.
While vb.net is its own language, completely separate from vb6, there is a lot of code that has been ported from vb6 to vb.net, and can rely on the matching operators to give many bits when true.
source share