The Art in Code

Snippets of famous, interesting, historically relevant or thought-provoking... code.


Website maintained by Filip Stanis Based on theme by mattgraham

004 - Hello World in Brainfuck

Code snippet of Hello World in Brainfuck

Snippet source

It doesn’t look like source code at first, but this snippet is actually valid code written in a language called Brainfuck.

Brainfuck supports only 8 commands, each represented with a single character. These valid commands are: ><+-.,[]. Everything else is ignored.

Brainfuck is considered an esoteric programming language meaning it has no practical purpose and is made for exploratory and research purposes, as a proof of concept or just for fun.

Try it out

You can run the snippet above by following this link.

Explanation

Brainfuck operates on top of a single “data” array and it can only manipulate a single element at a time, either changing its value or printing it out. > and < are used to move on to the next or previous element respectively, making Brainfuck function in a way that’s similar to a Turing machine.

Wikipedia has an in-depth explanation of the Hello World program above.