{{htmlmetatags>metatag-robots=() metatag-title=(NOT | ugBASIC User Manual) metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum) metatag-description=(Manual page for NOT) metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png) metatag-og:title=(NOT | ugBASIC User Manual) metatag-og:description=(Manual page for NOT) }} ====== ugBASIC User Manual ====== ===== NOT ===== ===== SYNTAX ===== = NOT x ==== PURPOSE ==== Performs a logical negation on an expression, as a bitwise negation. For comparisons managed as a boolean result (''TRUE'' or ''FALSE''), result is ''TRUE'' if expresions evaluate as ''FALSE''. The following table shows how result is determined: '''NOT TRUE = FALSE''' '''NOT FALSE = TRUE''' Generally speaking, the ''NOT'' operator performs a bitwise negation of the bits of the expression and sets the corresponding bit in result according to the previous table. Note that ugBASIC uses the convention, very common in BASICs of the 1970s and 1980s, of considering Boolean logic as implemented through the so-called "two's complement". In other words, the value ''FALSE'' is associated with a number composed of all ''0''s, in terms of bits. The value ''TRUE'' is, instead, associated with a number composed of all ''1''s, again in terms of bits. According to the 2's complement representation, a number composed of all ones is always equivalent to the number ''-1'', regardless of how many bits the number is composed of, while a number composed of all zeros is always equivalent to zero. According to this convention, there is a coincidence between bitwise and logical operations: in fact, a bitwise ''NOT'', applied to all the bits of the number, will be equivalent to the logical operation. Because the logical and bitwise operators have lower precedence than other arithmetic and relational operators, all bitwise operations must be enclosed in parentheses to ensure accurate results. ==== EXAMPLE ==== IF NOT x THEN PRINT "x is FALSE" ELSE PRINT "x is TRUE" ENDIF ==== ABBREVIATION ==== Nt ==== AVAILABLE ON ==== ==== ANY PROBLEM? ==== If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON NOT|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY ===== [[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]