The []
characters indicate a loop. The 10 +
s before it indicate how many times the loop will run. This becomes clear when you understand what the various commands mean, and the <<<< -
sequence of commands.
Each time the loop runs, it executes the following steps:
> move the pointer 1 space to the right
+++++ ++ add 7 to the current pointer
etc 3 more times > > >
<<<< - move back to the counter and decrement
This has the effect of adding "7, 10, 3, 1" 10 times. To put it another way, if you write the values at the first 5 pointer locations as you run the loop like they're in an array:
[10, 0, 0, 0, 0] at first
[9, 7, 10, 3, 1] after first run
[8, 14, 20, 6, 2] after second
...
[0, 70, 100, 30, 10] up to this, the loop ends since the counter is 0,
and control continues