Session 5

Learning targets

I can use repetition in programs

I can incorporate loops to make code more efficient

What are 'loops'?

NB - before this session, you'll need to have access to level set 3 on Dragon Spells (Tynker), named 'Deja Vu'

- Use 'Dragon code' activity. Print out and give to the children or just show on the screen.

- Ask pupils to ‘read’ the code and predict what they think will happen: - How do you start the program? - What will happen when you press 'play'? etc.

- After sharing some predictions about the code, ask them if there are any issues with what they see? There is only one algorithm that will work here! Mirror an iPad with Tynker and demonstrate which ones will/won't work.

- Introduce the vocabulary of ‘loop’ and explain that when we repeat something in programming we call it a 'loop'. Explain to the pupils that this loop uses a set number to repeat commands and/or functions. There is also another type which we call a 'forever' loop. Work through the next two levels together; pupils using their whiteboards to write down the commands.


Dragon Spells

  • Tell pupils to work through the remaining levels of 'Deja vu' independently. Partner any children finishing quickly up with those needing support; these are the first steps to becoming a 'Digital Ambassador' at NOPA!

  • Allow an appropriate amount of time for all children to have good practise.

  • When this time is up, stop the children and get them to screenshot the level they are on as a record for later. Have a conversation about loops. Ask children to define the term and ask why they think using loops is beneficial - get them to think from the point of view of a computer; loops means computers can act quicker/more efficiently.


Minecraft Code

  • Share this link with pupils: https://studio.code.org/s/minecraft/stage/1/puzzle/1

  • Complete the first puzzle together on the screen so they can become familiar with the interface.

  • Read out the narrative on the screen for puzzle 2. Explain how 'forever' loops are used in popular games like Minecraft and ask pupils for more examples from Minecraft or other games where characters/sprites might use forever loops.

  • Give them a few minutes to see if they can complete puzzle 2. When the time is up, ask one of the children to mirror their iPads, demonstrating and articulating their thinking.

  • Let them again continue their work independently and see if they can complete the Minecraft unit.

  • Pupils can have more practise if they need it, here: https://studio.code.org/s/course1/stage/13/puzzle/1


Key questions

  • Why are loops useful?

  • What id the difference between a 'set' loop and a 'forever' loop?

  • What examples of forever loops in the gaming world can you think of?

  • How does using a loop improve your programming?