We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Reversed

From Esolang
Jump to navigation Jump to search

Reversed is an esolang invented by User:None1. It doesn't have jumps, but its control flow can be reversed.

Commands

It has these commands:

R: reverse control flow direction
other characters: print the character

If the instruction pointer goes to the left of the first character, it moves to the last character, but not vice versa.

Examples

Hello, World!

Hello, World!

Quine

quine

Print 123321

123R

Interpreter in Python

a,p,d=input(),0,1
while 1:
 if p<0:
  p=len(a)-1
 if p>=len(a):
  break
 if a[p]=='R':
  d*=-1
 else:
  print(a[p],end='')
 p+=d