The "Repeat" Block
-
Prerequisite
- The “Forever” Block
Description
We often need to make a sprite repeat some actions a few times. For example, to make a dog spin around, we need to make it turn right 4 times:
We can make this program simpler using the repeat X times block.
The Repeat X Times Block
This block will repeat any other block in its “mouth” by a number of times:
Example
For example, we can rewrite the above program this way:
Clearly, this new program is simpler to write, and also easier for others to understand.
Imagine we need to turn the dog 1000 times, the program would be much longer without the repeat block!
-