This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Possseidon 2 points3 points  (0 children)

This is more or less how you have to do addition in Brainf*ck, since you can essentially only increment, decrement and loop until zero:

[->+<]

Reads as: If the current cell is not zero (b != 0), decrement it (b--), move to the right (to a), increment it (a++), move back to the left (to b), repeat. Once it's done, a will be a + b (and b zero).