User:PkmnQ/World's angriest control flow
There was an esolang I made that I never published on the esolang wiki that had the following instruction:
D:< - Jump to the previous D:< instruction
The language also had a "skip" instruction to break out of a D:< loop, but you could also imagine adding a condition instead, e.g.:
D:< - Jump to the previous D:< instruction unless the current cell is zero
(The original language was queue-based, but I will elect to ignore that.) Now, I feel like this would have the same issues as "brainfuck but you can't nest while loops (i.e. you can only go one [...] deep)", but what happens if you add a second copy of the instruction?
The easiest way to explore this would probably be a brainfuck derivative:
+ - blah - - blah > - blah < - blah . - blah , - blah A - Jump to the previous A (or to the beginning of the program) if the current cell is nonzero B - Jump to the previous B (or to the beginning of the program) if the current cell is nonzero
There's also another interesting variation where it jumps to the previous time it was ran:
A - If the current cell is zero, store the current instruction pointer into register A. If the current cell is nonzero, set the instruction pointer to register A.
Heck, it might even be possible to center an entire language around it if you do it right. I'm thinking about something with one counter for each unique character in some way to create the most cursed Minsky machine in existence.
There's just too many interesting ways to execute this idea. It's a very daunting form of control flow. Please consider adding this to your next sloplang so others can see.