Loops: repeat instead of copy

Knowledge Videos

Short animated explainers, organised by subject.

Loops: repeat instead of copy

A loop repeats blocks so you do not copy and paste them. Repeat, forever, and drawing shapes with a loop, shown with Scratch blocks.

Transcript

Computers are great at repeating. To draw a square, you move, turn, move, turn, and so on. That is eight blocks, and they are almost all copies.

A loop repeats blocks for you. Repeat four times: move, turn. It draws the same square, with only two blocks inside the loop.

The number says how many times to repeat. Change it, and the drawing changes. A forever loop keeps repeating until you stop the program.

Remember: a loop repeats blocks. Repeat runs a set number of times, and forever never stops.

More in this series