Choose a country
Grade 4Computer scienceLogic and algorithms

Branching in algorithms

Lesson goal: Know that a branching algorithm checks a condition and runs only one branch, and build “if…, then…, else…” algorithms and flowcharts.
← Logic and algorithms

About this lesson

Sometimes an algorithm takes a different path depending on the situation: this is branching. First a condition is checked: “Is it raining?” If it is met (yes), one branch runs; if not (no), the other runs. Only one branch runs each time. We write: “If it is raining, then take an umbrella, else take a cap.” In a flowchart the condition is drawn as a diamond (◇) with two arrows leaving it: “yes” and “no”. Actions go in rectangles, and start and end are shown as ovals.

Lesson goal: Know that a branching algorithm checks a condition and runs only one branch, and build “if…, then…, else…” algorithms and flowcharts.

What the book shows

In computer science the child first learns to think through unplugged games: recognising information, ordering steps and learning safety rules.

Textbook link:

This is not the textbook’s text but a short description of the topic. Check the exact page in your own textbook.

The lesson step by step

  1. 1

    Warm-up5 min

    A fork in the road.

  2. 2

    New topic10 min

    Conditions and branches.

  3. 3

    Practice10 min

    Flowchart shapes.

  4. 4

    Game10 min

    Drawing flowcharts.

  5. 5

    Wrap-up5 min

    Morning algorithm.

Let’s understand

For the student Simple language

ShapeMeaning
⬭ ovalstart / end
▭ rectangleaction: “take an umbrella”
◇ diamondcondition: “Is it raining?” → yes / no
If … , then … , else …

Going deeper

Scientific language: for older students, parents and teachers.

Conditions can sit inside other conditions: “If it’s raining, then: if it’s windy, a raincoat, else an umbrella.”

Play and check

Which flowchart shape?

How to write it down

  1. Draw a flowchart for “crossing at the traffic light”.
  2. Write 2 algorithms using “if…, then…, else…”.

How the classwork looks in the notebook

15 November1Classwork2◇ condition → yes / no3
Writing order: 1 Date 2 Heading 3 Line 3: ◇ condition → yes / no
Sample: the date and heading follow this country’s notebook rules.

Open notebook

Watch out: common mistakes

Running both branches. Only one runs each time.
Drawing the condition as a rectangle. Conditions go in a diamond.

Where it helps in life

  • Loops
  • Conditions in coding

At home

Core

  1. Draw a branching flowchart for getting ready for school.

Extra ⭐

  1. Build an algorithm with two conditions.

How to do it

  1. Do the task with a grown-up.
  2. Explain in words what you noticed.
Answers for parents

For example: Start → “PE today?” → yes: pack the kit → “Raining?” → yes: take an umbrella → End.

Step-by-step homework solution — Show the solution (try it yourself first)
  1. Think

    1. If a number is even, then write “even”, else write “odd”. 8 → even, 7 → odd.

How the homework looks in the notebook

15 November1Homework2Branching3
Writing order: 1 Date 2 Heading 3 Line 3: Branching
Sample: the date and heading follow this country’s notebook rules.

Check yourself