S3U

Science / Programming basics / Grade 5 / sc570

Programming Basics: Repeat a Group of Steps

Trace a fixed-count loop and notice which instructions are inside it.

All worksheets
5 questions0m 0s
Learn the skill

REPEAT 3 TIMES means execute its body three times. END marks the end of that body. In this plan, DRAW DOT is inside the loop and DRAW LINE is after END, so only the dot action repeats.

Worked example

REPEAT 3 TIMES: DRAW DOT; END; DRAW LINE produces three dots followed by one line. With a repeat count of zero, the body is skipped but the later line still happens.

REPEAT 3 TIMES contains DRAW DOT. After END, DRAW LINE runs once. The result has three dots and a single line.
REPEAT 3 TIMES contains DRAW DOT. After END, DRAW LINE runs once. The result has three dots and a single line.
Question 1 How many dots does the example draw?
Question 2 How many lines does the example draw?
Question 3 If the repeat count changes to 4, how many dots appear?
Question 4 With REPEAT 0 TIMES and the same later line, what appears?
Question 5 To draw a line on every repetition, where should DRAW LINE go?