not" is a reserved word in the programming language Lua.
In the BNF syntax of Lua, it appears as a terminal atom in one substitution rule:
unop → not
"unop" appears as a nonterminal atom in one substitution rule:
exp → unop exp
not" is the complementary unary logical operator (negation). Like the control structures, all logical operators consider "
nil" as false and anything else as true. The complement operator "
not" returns "
nil" if its argument is different from "
nil", and it returns a value other than "
nil" if its argument is "
In other programming languages, the "
not" keyword can have another meaning: a bitwise "not" on a numeric (usually unsigned integer) operand (giving another number, of the same type, as a result). A number may be considered an array of bits; in Eindhoven notation, any number (b) may be expressed as (+ : i ∈ Z : bi * 2i) - standard binary notation - each bi being either 0 or 1, thus making an array of bits. (For signed values, the sign bit is considered just another bit in the array; for integers, negative values of i need not be considered.) The "numeric not" performs the "logical not" operation on each bit, and places the result of each "logical not" in the corresponding position in the result. In symbols, "not b" evaluates to (+ : i ∈ Z : (not bi) * 2i). This is equivalent to the ones compelement operation.
The C symbol for "numeric not" (or "ones complement") is
!. There is no C symbol for "logical not", except that "numeric not" works equivalently on boolean types or when 0 is used for "false" and -1 is used for "true".