Repeats a sequence of code a specified number of times.
Instead of writing the same code again and again, you can use a repeat loop. When a program is run and reaches the repeat loop, it will run the code inside of that loop the specified number of times. Once the repeat loop is finished, the program will continue down the blocks.
Examples
Example 1
The make a new sprite
block is only used once, but repeating it five times allows five chemistry flask sprites to be created.
Example 2
Multiple lines of code can be used in a repeat loop, and a repeat loop can be used anywhere in a sequence of code.
Syntax
controls_repeat
Parameters
Name | Type | Required? | Description |
---|---|---|---|
number | The number of times the code will be repeated |
Found a bug in the documentation? Let us know at support@code.org.