# System Functions

NOT( ) | Invert String Bits/Logical Condition

## Formats

1. | Invert String: | NOT(data$[,ERR=stmtref])
2. | Invert Logical Condition: | NOT(num[,ERR=stmtref])

Where:

data$ | Data whose bits are to be inverted. String expression.
num | Value for inverting a logical condition. Numeric expression.
stmtref | Program line number or statement label to which to transfer control.

## Returns

Inverted value, string or numeric.

## Description

This function returns the inverted value of a string or numeric (i.e. with all ON bits turned OFF and vice versa).

## Format 1

Invert String
NOT(data$[,ERR=stmtref])

The NOT( ) function inverts the value of the bits in the character string specified. The string returned by the NOT( ) function will be the same length as the given data string. All OFF bits in the string will be returned ON while all ON bits will be returned OFF. The string expression can be a literal like "abc" or $8A$, a variable such as A$, or an expression using operators, such as A$="1234".

Example:

| A$=not($0010$) | yields A$=$FFEF$
| A$=not($FF00FF$) | yields A$=$00FF00$
| A$=not($5A5A$) | yields A$=$A5A5$

## Format 2

Invert Logical Condition
NOT(num[,ERR=stmtref])
Use this format to invert a logical condition. If the result of the condition is 0 (false), this function returns 1 (true); otherwise, this function returns 0 (false):

> if not(CST_ID$=CMPR_ID$) \
> then gosub NO_MATCH