# NOT

Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

Tags: program control

# Description

The NOT function is used to invert the Boolean value of an expression. It is useful for explicitly testing for a false condition. It takes the general form:

NOT(expression)
1

Where expression may evaluate to any Boolean result.

The NOT function will return Boolean TRUE if the expression returned a Boolean FALSE. It will return Boolean FALSE of the expression returned a Boolean TRUE. The function is useful for explicitly testing for the false condition of some test and can clarify the logic of such a test.

An example of use may be:

EQU Sunday TO NOT (MOD (DATE(), 7))
IF Sunday THEN
    CRT "It is Sunday!"
END
1
2
3
4

In this example, the expression MOD(DATE(),7) will return 0 (FALSE) if the day is Sunday and 1 to 6 (TRUE) for the other days. To explicitly test for the day Sunday we need to invert the result of the expression. BY using the NOT function to return a 1 (TRUE) if the day is Sunday and 0 (FALSE) for all other values of the expression.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide