+=-, -=+
A calculator with one number, where plus means minus and minus means plus.
7rigs, 2025 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
7rigs made +=-, -=+ in 2025, after Inverted, brainfuck and GolfScript, and the specification calls it the dumbest calculator. There is one counter, it starts at 0, and the two commands that look like adding and subtracting do the opposite. Four more commands print, each added, the specification says, to keep golfers interested. There are no loops and no input, so every program ends.
The machine
| Command | Does |
|---|---|
+ | Take 1 off the counter |
- | Add 1 to the counter |
d | Add 1, then print the counter |
i | Take 1 off, then print the counter |
= | Print the counter |
o | Print the counter, then set it to 0 |
1 | Print 1, 2 and 3 |
Each print is a decimal number on its own line. Every other character does nothing. The specification's Python interpreter reads the program with input(), so only the first line of a program runs.
Example
The two - raise the counter to 2.
The two - raise the counter to 2. = prints it, o prints it again and clears it, and the last = prints 0. Three + take the counter to -3.
Patterns it teaches
- Hostile design: the symbols say the opposite of what they do.
Further
See also
Also in Jokes
Write your own in Run Convert a program from +=-, -=+
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: u2b-3d-2d-2c-20-2d-3d-2b.
Command line
shib run u2b-3d-2d-2c-20-2d-3d-2b -e '1'shib manual u2b-3d-2d-2c-20-2d-3d-2bSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/u2b-3d-2d-2c-20-2d-3d-2b.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org