OP_NOT is used to invert the boolean value of the top item on the stack. If the top item is nonzero, OP_NOT replaces it with 0 (false), and if it is 0, OP_NOT replaces it with 1 (true). This opcode is often used in scripts that require logical negation, such as inverting conditions or toggling boolean flags.
OP_Code Walkthrough
Logical NOT of the top item of the stack
Pop Top Item
Compute logical NOT of item
Push Item