### Lesson Objective

To learn what loops are and the pattern for repetition in Go programs

### Success Criteria

• I know what repetition is
• I know what repetition is used for
• I know what loops are and the different loop types
• I know the patterns for loops in Go
• I know how to use the loop patterns in Go

• repetition
• loop
• for
• repeat
• repeat until

### Period of Study

KS2 Emerging

Co2/1.1 design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts

Co2/1.2 use sequence, selection, and repetition in programs; work with variables and various forms of input and output

Co2/1.3 use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs

Maths - The pupils must have covered less than, less than or equal to, greater than, greater than or equal to, equal to and not equal to for numeric values. The pupils will need to be able to write conditions that terminate loops.

?????

### Resources/Homework

The pupils will need to have Go installed on the school computers. They will also need a text editor installed. For Windows/MacOS X and Linux they should install Atom. For RaspberryPi they should install liteIDE. See the install guides on the website for more details.

### Prerequisites

The example program uses the times tables up to 12, so the pupils must be familiar with these.

The lesson builds on earlier lessons so the pupils should have covered Lessons 1-9 in the series

### Starter Activity

Show the pupils how a regular square, triangle, pentagon can be drawn one step at a time.

Show them that the multiplication is repeated addition.

Show them that in a times table only one number varies. It varies between 1 and 12 so the entire table is a repetition of a single multiplication e.g. `3 * n` where `n` is 1..12

### Main teaching points

• Introduce the idea that smaller, similar steps can be repeated to achieve a larger goal.
• Show what repetition is and what it is used for
• Explain the different loop types
• Show the patterns for loops in Go
• Explain the `timesquiz` program in Go

#### For High Achievers

The pupils should understand that repetition is a repeated execution of a set of instructions.

The pupils should know that repetition is also called a loop.

The pupils should understand that loops are used to make a program easier to understand, shorter and to help express algorithms.

The pupils should know that there are three basic loop types.

The pupils should understand and recognise the pattern for a loop that continues while a condition is true without support.

The pupils should know when the condition in the loop is tested without support.

The pupils should be able to change the `timesquestion` program into the `timesquiz` program and run it without support

#### For Middle Achievers

The pupils should understand that repetition is repeated execute of a set of instructions.

The pupils should know that repetition is also called a loop.

The pupils should understand that loops are used to make a program easier to understand, shorter and to help express algorithms.

The pupils should know that there are three basic loop types.

The pupils should understand and recognise the pattern for a loop that continues while a condition is true with support.

The pupils should know when the condition in the loop is tested with support.

The pupils should be able to change the `timesquestion` program into the `timesquiz` program and run it without support

#### For Low Achievers

The pupils should understand that repetition is repeated execute of a set of instructions.

The pupils should know that repetition is also called a loop.

The pupils should understand that loops are used to make a program easier to understand, shorter and to help express algorithms.

The pupils should know that there are three basic loop types.

The pupils should understand and recognise the pattern for a loop that continues while a condition is true with considerable support.

The pupils should know when the condition in the loop is tested with considerable support.

The pupils should be able to change the `timesquestion` program into the `timesquiz` program and run it with support

## Numbers

### What You are Going to Learn?

Computers are used to process data. All data is made up of numbers. Yes, really! Everything is just a bunch of numbers to a computer. These are the only things they understand.

We are going to explain how numbers are used in Go programs. Then we are going to show you how to do type sums in Go.