← Years 7–8 Creating Digital Solutions

Drawing a decision inside a loop in a flowchart

A diamond on the loop path is asked on every pass. Both its Yes and No branches rejoin, then go back to the loop test, usually after the counter update.

Understanding Drawing a decision inside a loop in a flowchart in Years 7–8 Creating Digital Solutions

What it does: Both paths meet at the same join point. From there one path goes to the counter update and back to the loop test. The diamond n > 3? sits inside the loop path. Each time the arrow returns to i <= 5?, the flow reaches the diamond again. Both branches must rejoin, or the loop would stop working on some passes. Even an empty No branch needs an arrow that rejoins the path. Put i <- i + 1 after the branches rejoin so it runs on every pass, whichever way the decision went.

Common mistakes: The No branch of the decision must not end the loop. Both Yes and No rejoin, then go to the counter update and back to the loop test. The line should end with No: skip, or show No rejoining. The counter update must happen after both branches rejoin. If only the Yes path adds 1 to i, the No path never changes i, so the loop never ends. It should say Yes and No: i <- i + 1.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 3–47) and word search (Modules 3–125).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A decision diamond sits inside a loop in a flowchart. How often is it asked?
Every time the loop goes around (every pass)Only once, on the first pass
Matches
n > 5? No -> Stop (Yes -> count <- count + 1 -> i <- i + 1 -> i <= 10?)
↓
The No branch goes to Stop instead of rejoining. The loop would end the first time the answer is No. It should rejoin and go back to the loop test.
Applying
Meanings
Term
decision inside a loop
Meaning
A diamond on the loop path is asked on every pass. Both its Yes and No branches rejoin, then go back to the loop test, usually after the counter update.
Practice
START
Testing
Gaps
A decision in a loop is drawn as a
Check Answer
Spots
2Loop test: i <= 5? No: End
3Is i > 3? Yes: add i, No: End

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Zebra' badge — Pattern Matcher, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A decision diamond sits inside a loop in a flowchart. How often is it asked?
A. Every time the loop goes around (every pass) ✓
B. Only once, on the first pass
The diamond is on the loop path, so the question is asked again on every pass.
2. Which describes what happens to the Yes and No branches of a decision inside a loop?
A. Only the Yes branch goes back to the loop test; the No branch ends the flowchart
B. Both branches rejoin and lead back to the loop test ✓
Both branches must rejoin, or the loop would stop working on some passes.
3. A flowchart loop counts from 1 to 10 and checks if each number is even. Where does the 'is it even?' diamond go?
A. Outside the loop, after the loop has finished
B. Inside the loop, after the loop test and before the arrow back ✓
To check every number, the diamond has to be on the loop path so it is asked each pass.
4. Where should the counter update (like i ← i + 1) go so that it happens on every pass?
A. After the branches rejoin, just before returning to the loop test ✓
B. Only on the Yes branch of the decision
If the update is only on one branch, the other branch never changes the counter and the loop can run forever.
5. In a loop with a decision, the No branch does nothing. What should its arrow do?
A. Join the Yes branch's path so both continue to the counter update ✓
B. Stop with no arrow, because nothing happens on No
Even an empty No branch needs an arrow that rejoins the path.

Match the Pairs

score >= 50? → A decision diamond inside the loop that is asked on every pass
i <- i + 1, then arrow to i <= 10? → The counter update, then back to the loop test
Both the Yes and No branches rejoin before the loop test → Yes: count <- count + 1 -> join. No: join. Then i <- i + 1 -> i <= 10?
The decision is asked again on every pass of the loop → i <= 5? Yes -> n > 3? -> ... -> i <- i + 1 -> back to i <= 5?
n > 5? No -> Stop (Yes -> count <- count + 1 -> i <- i + 1 -> i <= 10?) → The No branch goes to Stop instead of rejoining. The loop would end the first time the answer is No. It should rejoin and go back to the loop test.
n > 5? Yes -> count <- count + 1 -> i <- i + 1. No -> i <= 10? → The counter update is only on the Yes branch. When the answer is No, i never changes, so the loop may never end. Rejoin the branches first, then update i.

Key Term

decision inside a loop
A diamond on the loop path is asked on every pass. Both its Yes and No branches rejoin, then go back to the loop test, usually after the counter update.

Fill in the Blanks

1. A decision in a loop is drawn as a diamond
Hint: Type the name of the flowchart shape used for a decision.
2. Is score > 10? Yes -> count <- count + 1 No -> go to counter update
Hint: Type the label on the other branch leaving the diamond.
3. Both branches go back to the loop test
Hint: Type the part of the loop that both branches return to.
4. Counter update: i <- i + 1
Hint: Type the operator that makes the counter go up.
5. The diamond is asked every pass
Hint: Type the word that shows how often the question is asked in the loop.

Spot the Error

Question 1
A Set total <- 0, i <- 1
B Loop test: i <= 5? No: End
C Is i > 3? Yes: add i, No: End
D Yes and No: i <- i + 1
E Go back to loop test
Line C — The No branch of the decision must not end the loop. Both Yes and No rejoin, then go to the counter update and back to the loop test. The line should end with No: skip, or show No rejoining.
Question 2
A Set count <- 0, i <- 1
B Loop test: i <= 10? No: End
C Is i even? Yes: count + 1
D Only Yes: i <- i + 1
E Go back to loop test
Line D — The counter update must happen after both branches rejoin. If only the Yes path adds 1 to i, the No path never changes i, so the loop never ends. It should say Yes and No: i <- i + 1.
Question 3
A Set i <- 1, big <- 0
B Loop test: i <= 8? Yes: End
C Is i > 5? Yes: big <- big + 1
D Yes and No: i <- i + 1
E Go back to loop test
Line B — The loop test branches are swapped. While i <= 8 is true (Yes) the flowchart should carry on to the decision. Only No should lead to End.
Question 4
A Start: set score <- 0
B Loop test: i <= 6? No: End
C Is i odd? Yes: score+1
D Yes and No: i <- i + 1
E Go back to loop test
Line A — The counter i is never given a starting value. The loop test and the update both use i, so it must be set to 1 before the loop. The line should be Start: set score <- 0, i <- 1.
Question 5
A Set n <- 0, i <- 1
B Loop test: i <= 7? No: End
C Is i < 4? Yes: n+1
D Yes and No: i <- i + 1
E Go back to loop test
Line C — A decision diamond needs both a Yes and a No exit. The No branch is missing, so the flowchart does not say where to go when i < 4 is false. It should add No: skip, which rejoins the path.

Student with a class code? Join your class →