Session 3
Follow-on and extension work on multiple repeat loops and nested repeats
Objectives
Understand and use simple repetition
Use the repeat instruction several times in a program
Use a repeat within a repeat loop (extension)
Resources | Vocabulary |
---|---|
• Levels 23 to 25 in Rapid Router • Resource sheets S2 sheet 3, S3 sheet 1 and sheet 2 | • Repeat, repetition |
Let’s get started
The repeat loop is a key concept in computer programming.
This session consolidates understanding of the ‘repeat’ loop, giving students a chance to work through levels 23 to 25. Several of these levels require more than one repeat loop. It also gives a chance for the more advanced students to look at the more complex ‘repeat within a repeat’.
Recap on level 22 [fig S3.1] with the class.
Can you spot parts of the route where blocks of code are repeated?
This route includes up to six repeat loops for the forward instructions.
Main activity
Give out resource sheet S2 sheet 3 [fig S3.2] to those who have not tackled level 22 independently, and ask students in pairs to mark out the sections of the road where repeat could be used, recording their code.
Others will be able to tackle levels 23 and 24 using several repeat loops.
For gifted and talented pupils, look at level 23, where they can ‘nest’ a repeat loop within a repeat loop.
Ask them to look at resource sheet 1 [fig S3.3] and work out their algorithm using repeat.
They will probably come up with: |
Can they see another repeat pattern here? They may see that it is repeated twice, so you could put that sequence inside a repeat loop.
Unplugged activity for gifted and talented pupils
Give gifted and talented students resource sheet 2 [fig S3.4] on nested repeat, with the given code, and ask them to draw the route.
This is the solution. |
Last updated