When it comes to the weird and wonderful world of esoteric programming languages, the above Brainfuck program is pretty elegant. It's a basic implementation of the echo program: printing back what the user inputs.
The complete language consists of eight single-character commands. The four used in the echo program is:
, – accept one byte of input and store it at the current memory cell
. – output the byte at the current memory cell
[ – if the value of the current memory cell is zero, jump forward to the command after the matching ]
] – if the value of the current memory is nonzero, jump back to the command after the matching [
The complete language consists of eight single-character commands. The four used in the echo program is:
, – accept one byte of input and store it at the current memory cell
. – output the byte at the current memory cell
[ – if the value of the current memory cell is zero, jump forward to the command after the matching ]
] – if the value of the current memory is nonzero, jump back to the command after the matching [