Write a program that outputs its source code in reverse when run, and outputs its source forwards when I reverse the source. If your program is "abcd", when run with no arguments it should output "dcba", and when I run the program "dcba" it should output "abcd."

This is a challenge, so both your forwards and reverse program must follow the rules of proper quines. Your source code may not be a palindrome.

This is a challenge, so the shortest code by byte count wins.


1 Answer 1


><> (fish), 15 bytes




Try it

ti yrT

  • \$\begingroup\$ Could you add a try it link for the reversed version? \$\endgroup\$
    – noodle man
    Sep 28, 2023 at 16:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.