LearnBrainfuck basics

Building numbers

By the end of this lesson you can make any number with a short program, and print a word of your own choice.

Eight times nine

A letter needs a number like 72 or 105, and typing that many plus signs is long. This program of 24 commands prints the letter H, number 72. Press Play, or drag the slider through the steps, and watch cell 0 and cell 1 while the loop runs:

Sixty-five

Now you build the number. Write a program that prints the letter A, which is number 65, with at most 30 commands:

Hi

The box holds the program of the first figure, which prints H. Add to it so that it prints Hi. The small letter i is number 105:

Your own word

Type a word in the first box, then write a program that prints exactly that word. The chart of Lesson 3 gives the numbers:

Check yourself

A free exercise

Print your word with an exclamation mark (number 33) after it. Or print two words with a space (number 32) between them. Nothing is checked here:

What you can do now

You can build a number with a loop that multiplies, and print a text by walking from each character to the next. No new command came in this lesson: it was the loop of Lesson 4 put to work.

So far your programs always say the same thing. Lesson 6 lets them listen.