-
Computers are really good at repeating actions.
-
You can count to ten, or twenty or one hundred...
-
But a computer can count to a billion or even a trillion.
-
It won't get bored and it will only take a few seconds.
-
Whether it's counting or drawing or anything,
Computers can repeat things hundreds or even billions of times.
-
In programming, we call this a loop.
-
A loop is how you repeat your code over and over again.
-
For the next puzzle,
your goal is to help Anna to create a square with the repeat block.
-
Any blocks of code you put inside a repeat block,
will be repeated in sequence, as many times as you want.
-
To draw a square, you can use the "move forward" and "turn" block 4 times.
-
The easier way is to tell the computer to move forward and turn by 90 degrees once
and then tell the computer to repeat these actions four times.
-
To do that, you need to place the move forward and turn right in a repeat block.
-
Remember, you can change the number in the repeat-block to anything, and it will repeat the actions in the block that many times.
-
[ Anna draws a square with her Foot ]