Tuesday, August 09, 2005

VB is Not Logical

Ah the joys of VB.....

Not is VB for both ! and ~ operators instead of one of them. That
creates a weird problem when it decides to do bitwise instead of
logical negation on you.
Mod is VB for % and is the modulus operator

So you would think:

Not ( (1+1) Mod 2 ) would evaluate to 1 right?

Actually it evaluates to -1

So what about Not 1? It evaluates to -2

And if you guessed thats because VB is storing things as numbers and not actually booleans you guess right.

0 Comments:

Post a Comment

<< Home