6 of 6
clarify version
Martin Ender
  • 196.8k
  • 65
  • 444
  • 970

Befunge 98, 19 18 Bytes

#New answer (from undergroundmonorail)#

"ck,@!dlroW ,olleH

##Explanation##

  • " starts string mode
  • Everything that follows is pushed to the stack. The stack is now Hello, World!@,kc
  • After hitting the end, interpreter go back to the start
  • It encounters " again, ending string mode
  • 12 is pushed to the stack (c)
  • k takes the top value of stack and executes the next command the instruction pointer can see that many times
  • , pops a value from stack and outputs it as a char. It has been executed 12 times by last k instruction, and one time more when the interpreter actually reads the , instruction
  • @ ends the program

The difference with the old answer is that we cleverly reuse the " character by using Befunge's looping behavior when it hits the end of the line. Since it might be less intuitive, I'm letting the old one as well. Also, you may have noticed that the stack will still contains some characters (ck,@) because of this nice trick, leaving some mess if we ever wanted to do something after that.

#Old Answer# "!dlroW ,olleH"ck,@

This works for funge and befunge 98

Explanation

  • Everything between "" is pushed to the stack. ('H' is now on top.)
  • c (12) is pushed to the stack
  • k takes the top value of stack and executes the next command the instruction pointer can see that many times.
  • , pops a value from stack and outputs it as a char. It has been executed 12 times by last k instruction, and one time more when the interpreter actually reads the , instruction
  • @ ends the program