lesson

Choose a stopping rule

1 · Learn

A count-controlled repeat ends after its specified number of repetitions. A forever loop continues until the program is stopped or another control ends it.

Choose according to the purpose. A short three-beat introduction needs a known ending. An animation that should keep moving while a project runs may use a continuing loop, but users still need a clear stop control.

Repeat 3: known endingForever: continuesStop control: user can end
Key words and supplied examples.

2 · Worked example

I use repeat 3 for a three-ring signal. Forever would keep ringing, which does not match the plan and could be annoying.

3 · Your turn

Which loop better fits flashing an on-screen shape exactly six times: repeat 6 or forever?

Check your answer

Repeat 6, with a clearly defined flash sequence inside it.

4 · Apply your learning

Compare count-controlled and continuing loops in an approved tool using gentle movement rather than rapid flashing or loud repeated sound.

Adult guidance and safety

Use an adult-approved offline or school-managed application and invented non-personal data. Do not change real network settings, publish recordings or upload others' images. Follow paper models with practical work in a suitable tool and check saved files reopen.

Open your writing and drawing pad

Write, draw or show your working. Use a mouse, pen or finger. This pad is not a submitted answer.

Not saved to your account. Download your drawing as PNG and your typed notes as TXT before leaving or refreshing. They are separate files. Do not enter private information.

Open a picture saved on this device to draw on it again. Opening replaces the drawing, but Undo can restore it. PNG only, up to 4 MB and 4096 × 4096 pixels. The picture stays in this browser; it is not uploaded. Paper lines in a saved picture become part of that picture.

Drawing is unavailable. Use the typed working area below.

Your pad is empty.

Open a UTF-8 TXT file from this device, up to 40 KB and 10,000 characters. It stays in this browser. Opening can be undone until you type again. Downloads keep a new copy; they do not change the file you opened.

Typed notes are not submitted answers.

Practice this lesson

Lesson resources

Browse the available practice activities and worksheets for this lesson.

Open course resources

Your progress

Ready to continue?