Caché MultiValue Basic Reference
NOT
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the logical complement of an expression.
Synopsis
NOT(expression)
Arguments
expression An expression that resolves to a boolean value.
Description
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).
Examples
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