EU Code Week 2020 - Day Four - Go Loopy

YouTube Join us LIVE now!

About this lesson

Today's Playground:
Learn to Code 1 playground
Learn to Code 1
Day four: go loopy playground image One of the things that computers like iPads are good at is repeating things over and over again.

For today's session we'll learn about loops in Swift and use them to let the iPad do the work for us and solve some puzzles more easily!

Video

Recorded Wednesday, October 14th, 2020:

Recorded Wednesday, October 21st, 2020:

Unplugged Activity

Looping dance moves

You will need:

Activity:

The TikTok social media platform is famous for sharing short dances. Many people will copy the dance moves and recreate their own version of a dance. In the Fortnite game, the characters perform repeating dances called 'emotes'. You can watch the video of 'How to do the renegade' to see the moves. Then you decide how many times you would repeat the dance.

The Banana Banana Meatball dance has many repeating moves that are looped before moving to the next step.

Can you perform a dance with repeated moves? Can you teach a partner how to do that dance? Can you create your own looping dance?

Extend

Extend: spot the patterns in the playground
Practice: Spot the pattern in the remaining loops playground pages. Look specifically at Loop Jumper, Branch Out, Gem Farm, and Four Stash Sweep. What are the patterns you find yourself repeating again and again?

How do you find out what code you should be looping through? Sometimes you might write the code out the long way and go back and spot which lines of code get repeated. Other times you might be able to spot it before you even write a line of code. With a little practice, you'll get quicker at figuring out when you can use a loop.

Other loops: If you feel like you've mastered for loops, jump ahead to the While Loops chapter. Once you've tried your hand with while loops, try solving the Choosing the Correct Tool, Four by Four, and Turned Around pages. Which loop did you choose (if any) to solve the puzzles?