Logical Operator NOT

The logical operator NOT behaves differently in VBScript than it does in the built-in scripting language.

NOT Operator in VBScript

In VBScript, the NOT operator inverts the bits of a given numeric value, producing its complement number according to the “two’s complement” system of signed numbers that is used by computers. The table below illustrates the behavior of the NOT operator in VBScript for the syntax…
  result = NOT expression  
If expression is… Then result is…
−3 2
−2 1
−1 0
0 −1
1 −2
2 −3
3 −4
Note: By default, when you attempt to write any numeric value other than 0 to a Boolean tag, the tag automatically assumes a value of 1. Therefore, if VBScript’s NOT operator is applied to a Boolean tag with a value of 1, then the value of the tag does not change; the operator returns a value of −2, but the tag cannot accept this value so it again assumes a value of 1.

You can configure IWS to treat Boolean tags like Boolean variables in VBScript, so that the NOT operator in VBScript will work as expected. For more information, please see Boolean Tags and Boolean Variables.

NOT Operator in Built-in Language

In contrast, the NOT operator in the Built-in Scripting Language toggles the given numeric value as if it is a natural boolean. The table below illustrates the behavior of the NOT operator in the Built-in Scripting Language for the syntax…
  result = NOT expression  
If expression is… Then result is…
0 1
≠0 0

Logical Operator NOT