Year 7 · Spring 2
Scratch I: Programming essentials · Lesson 4 of 5
Iteration: count-controlled and condition-controlled loops
PracticalTopic 11 Algorithms
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
You will learn to
- Explain the difference between a count-controlled loop and a condition-controlled loop.
- Use repeat to draw a shape with fewer blocks.
- Use repeat until to keep going until something happens.
- Trace a loop and count how many times it runs.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Success criteria
You have got it when you can say:
- I can draw a square with repeat 4 instead of eight separate blocks.
- I can make a sprite keep moving until it touches something.
- I can say how many times a loop will run before I run it.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
How many times does FOR i ← 2 TO 8 repeat?
A 7B 6C 8
A. 7
- Last unit
SELECT FirstName FROM Students WHERE Year = 8; returns…
A Every field of every studentB Only the first names of Year 8 studentsC The number of Year 8 students
B. Only the first names of Year 8 students
- Earlier this year
Logging into a friend's account 'just to look' is…
A Only illegal in SpainB Legal if you change nothingC An offence under the Computer Misuse Act
C. An offence under the Computer Misuse Act
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Key words (1 of 2)
- trace table
- Records variable values step by step to check logic.
- Algorithm
- Precise, ordered, finite steps to solve a problem.
- Decomposition
- Breaking a problem into smaller ones.
- Abstraction
- Ignoring detail that doesn't matter for the problem.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Key words (2 of 2)
- Sequence · selection · iteration
- Steps one after another. First this, then this.
- Pseudocode
- Code-like writing for algorithms, without strict rules.
- Variable
- A named place in memory that holds a value.
The explanation · step 1 of 1
Trace tables
A trace table records every variable at each step, to check the algorithm works.
| Pass | n | n > biggest? | biggest after |
|---|---|---|---|
| 1 | 7 | No | 7 |
| 2 | 3 | No | 7 |
| 3 | 12 | Yes | 12 |
| 4 | 5 | No | 12 |
Output: 12. Correct.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Try it: Trace 'find the biggest'
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Quick quiz · 1 of 3
Which shape is used for OUTPUT total?
- A Diamond
- B Parallelogram
- C Rectangle
B. Parallelogram
Input and output are always parallelograms.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Quick quiz · 2 of 3
Breaking a problem into smaller parts is…
- A Iteration
- B Abstraction
- C Decomposition
C. Decomposition
De-compose = take apart.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Quick quiz · 3 of 3
An 'if… else…' is…
- A Sequence
- B Selection
- C Iteration
B. Selection
It selects one path.
Year 7 · Scratch I: Programming essentials · Lesson 4 of 5
Exit ticket
Answer on paper before you go. Then check.
In a flowchart, a decision is a…
A DiamondB OvalC Rectangle
A. Diamond Diamonds have yes/no arrows coming out.
The Tube map leaves out real distances. That's…
A Pattern recognitionB AbstractionC Decomposition
B. Abstraction Abstraction removes detail that doesn't matter for the problem.