19 January 2023
Going loopy with Scratch
Iteration is always a difficult concept to grasp for younger pupils. I have seen many teachers modelling loops in Scratch, or other blocky programming languages, and then pupils just copying the code from the board to replicate exactly what they have been shown, or just changing the number inside the loop block. This means that most students don’t get the concept, even though they end up with a working program.
Prior learning is essential here; pupils need to master the basic tools and sequencing them in Scratch before introducing them to the more challenging programming constructs, selection and iteration. We give them extensive practice using START, STOP, WAIT, MOVE, TURN, POINT TOWARDS, GLIDE, SAY, VARIABLES and they sequence them to make working games. We ensure they master this before we move to loops so learners can see the advantages of using iteration and have fun at the same time.
A possible activity to do in pairs or individually:
- Objective: To make the cat jump 5 times to get to the other side of the river
- Pupils go to this basic Scratch “jump” online game (No time wasted choosing Sprites/backdrops): https://scratch.mit.edu/projects/789326556/editor
- Pupils need to create the code to jump to the second rock. There will be here quite a lot of trial and error. This stage is important for students to apply the basic techniques they learned before and to learn to debug. Have a rule for pupils to try twice on their own if they struggle, then ask another pupil, before they ask you for help. The teacher circulates and provides live feedback at this stage to ensure everyone is supported and they achieve the goal. A possible solution using variables to keep track of x and y co-ordinates and the glide block to move the cat from the first to the second rock: https://scratch.mit.edu/projects/790451019/editor
- Have a whole class discussion to make them think if copying and pasting this code 5 times will achieve the objective. Allow them to do just that and discuss afterwards to discover that it works but there is a lot of duplicating code. Ask them: What is there were 100 rocks? What is a better way to code this?
- Do some modelling of loops using a different scenario so they don’t copy the code. Model the scenario below with and without a loop. See example https://scratch.mit.edu/projects/789914005/editor
- Finally, provide time for pupils to apply a loop to the original “jump” scenario in order to have a better and more elegant solution. See two possible solutions below, one simple and one more complex: https://scratch.mit.edu/projects/790454809/editor
Two possible extension tasks for the more able or keener pupils are to ask them to create it using a different looping block rather than the REPEAT block and to get the cat to jump back to the first rock.
To see more ideas for possible games using loops, go here: https://scratch.mit.edu/explore/projects/animations/ or find Scratch tutorial on how to make a more advanced jumping game here: https://www.youtube.com/watch?v=1jHvXakt1qw
Do you introduce loops to younger pupils in a different way? How? Please share.
Discussion
Please login to post a comment
This looks really interesting, but you haven’t shared the links to Scratch, they shouldn’t have editor in the URL. But am looking forward to looking at this with my ITE students when we look at loops!
This for example will work: https://scratch.mit.edu/projects/581959104
But this for the same file won’t: https://scratch.mit.edu/projects/581959104/editor/
It may look like it just needs editor removing I should add but could cause confusion for the children, it is because you copied the link from the creation page not your front page where you share it that is all. (In your files removing editor doesn’t work as you didn’t share it I think).