💻 TechnologyGrade 5Lesson 26
← Back🔒 PDF with full access

Conditions, Loops & Events

Lesson preview: the Mini Lesson and Vocabulary are open to everyone. Guided practice, exercises, the parent checklist and the printable PDF worksheet come with full access (free 7-day trial or membership).

Learning Objectives

  • 1Identify conditions that let a program make decisions
  • 2Recognize loops that repeat instructions
  • 3Spot events that trigger code to run
  • 4Combine conditions, loops, and events into a simple plan
📘

Mini Lesson

Once you can list steps in order, programs need three more building blocks: conditions, loops, and events. Conditions ask a yes/no question. Loops repeat steps. Events listen for something to happen. Mix them together and your program can think, repeat, and react.

Condition — Make a Decision

A condition checks if something is true and then chooses what to do. The shape we use to draw it is a diamond, because a diamond has two paths leaving it: Yes and No.

  • If hungry, then eat — otherwise wait.
  • If it is raining, then take an umbrella.
  • If the score is at least 10, then win the game.
  • If it is dark, then turn on the light.

Loop — Repeat Steps

A loop tells the computer to do the same thing over and over without you typing it many times. There are loops that count, loops that visit each item in a list, and loops that keep going until something changes.

  • Repeat 5 times — count from 1 to 5.
  • For each item in a list — visit every name in turn.
  • While the battery is low — keep charging.
  • Until the door opens — keep knocking.

Event — Listen and React

An event is a moment the program is waiting for. When it happens, the program runs a chunk of code called a handler. Every game and app you use is full of events.

  • When a key is pressed — move the player.
  • On button click — submit the form.
  • When the game starts — show the title.
  • On timer tick — update the clock.
Three Code Building BlocksThree Code Building BlocksIFhungry?yes / noYes -> eatNo -> waitDecideone pathLOOPrepeat5 timesRun thesteps againSave typingEVENTon clickwhen keyWait, thenreact fast
Sample Script: All Three TogetherSample Script: All Three TogetherEVENTwhen start clickedIF path is clear?yes / noNoYesLOOPrepeat 5 timeshop forward 1 stepIf No: stop and wait
💡

Tip: read code aloud and label each block. Say "this is a condition" or "this is a loop" — naming the blocks makes a tangled program much easier to read.

Vocabulary
condition
A yes/no question in code that picks which path to take.
loop
A block of code that repeats steps without retyping them.
event
Something a program waits for, like a click or a key press.
trigger
The exact moment that causes an event handler to run.
branch
One of the paths a program takes after a condition is checked.
Free · 7 days · No credit card

Unlock the full HSEA system for 7 days.

Add your first kid profile and your 7 days start: every lesson in every grade, saved progress for each child. Nothing to set up, no card required, nothing to cancel.

  • ✓ All 1,680 lessons, Grades 1–6, every subject
  • ✓ Profiles + saved progress for every kid
  • ✓ Printable lessons with answer key
Start your 7-day free trial →
← Lesson 25: Sequencing & AlgorithmsLesson 27: Variables & Debugging →