Inverted Logic
Ask whether true is true, and it says false.
PinkysWorld, 2022 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
PinkysWorld made Inverted Logic in 2022, a language that reverses booleans. A line holding true prints false, and and gives the answer of nand. The inversion is not complete, though. By the specification's own table or, nor, xor and xnor give their usual answers, and only and and nand trade places.
Read the story
Apart from that a program prints text, one statement a line. There is no input, no variable and no loop.
The machine
| Statement | Does |
|---|---|
print text | Print the text |
println text | Print the text and a line feed |
printsp text | Print the text and a space |
true, false | Print the other one |
a and b, a nand b | Print a nand b, or a and b |
a or b, a nor b, a xor b, a xnor b | Print what they say |
exit | End the program |
; text | A comment |
The specification also lists keywords and errorcodes, which print lists kept on a separate interpreter page, and says numbers flip their sign without saying how to write one. This implementation leaves those three out. A boolean answer prints with a line feed.
Example
The last one prints a greeting on one line, then or answers true as usual, and false prints true.
The last one prints a greeting on one line, then or answers true as usual, and false prints true.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Inverted Logic
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: inverted-logic.
Command line
shib run inverted-logic -e 'print apple'shib manual inverted-logicSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/inverted-logic.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org