Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Returns the logical complement of an expression.
expression An expression that resolves to a boolean value.
The NOT function returns the logical complement (inverse) of a boolean expression. Thus all expressions that evaluate to 0 become 1, and all expressions that evaluate to 1 (or any non-zero numeric value) become 0. A string is parsed as a number until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7 (boolean 1), and thus NOT returns 0. If expression is the null string or a non-numeric value, NOT parses it as boolean 0, and thus returns 1.
You can use the ANDS and ORS functions to perform logical comparisons on two values (either single expressions or arrays).
The following example uses the NOT function to return the inverse of a boolean expression:
PRINT NOT(1);          ! Returns 0
PRINT NOT(0);          ! Returns 1
PRINT NOT(7);          ! Returns 0
PRINT NOT(-7);         ! Returns 0
PRINT NOT("7dwarves"); ! Returns 0
PRINT NOT("fred");     ! Returns 1
PRINT NOT("");         ! Returns 1
See Also

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA