Boolean Not operator in VBScript

Posted by Lumi on Stack Overflow See other posts from Stack Overflow or by Lumi
Published on 2012-06-03T16:14:22Z Indexed on 2012/06/03 16:40 UTC
Read the original article Hit count: 254

Filed under:
|
|

Consider the following two conditionals (involving bitwise comparisons) in VBScript:

If     1 And 3  Then WScript.Echo "yes" Else WScript.Echo "no"
If Not(1 And 3) Then WScript.Echo "yes" Else WScript.Echo "no"

Prints first yes, then no, right?

cscript not.vbs

Wrong! It prints yes twice!

Wait a second, the Not operator is supposed to perform logical negation on an expression. The logical negation of true is false, as far as I know. Must I conclude that it doesn't live up to that promise? How and why and what is going on here? What is the rationale, if any?

© Stack Overflow or respective owner

Related posts about vbscript

Related posts about boolean