3
\$\begingroup\$

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.

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

><> (fish), 15 bytes

"0:g}!|o|!}g:0'

Reversed:

'0:g}!|o|!}g:0"

Try it

ti yrT

\$\endgroup\$
1
  • \$\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.