🧩 Multimedia & Coding

Computational Thinking & Block Coding

⏱ 3 hr3 topicsInteractive
🎯 By the end: You can explain computational thinking, use variables and conditionals in Scratch, write loops, use sensing blocks, and plan a simple interactive game.

Before you write code, you need to think like a problem-solver. Computational thinking is a way of breaking problems down — then you build the solution by snapping together blocks in Scratch.

1Computational thinking

Computational thinking has four key ideas:

PillarMeans
DecompositionBreak a big problem into smaller, easier parts
Pattern RecognitionSpot similarities and things that repeat
AbstractionFocus on the important details, ignore the rest
Algorithm DesignWrite the step-by-step plan to solve it
Example — making a sandwich: decompose into steps, spot the pattern (repeat "add a layer"), abstract away the bread brand, and write the algorithm (the recipe).
Key points
  • Computational thinking = decomposition, pattern recognition, abstraction, algorithm design.
  • Decompose a big problem into small parts; spot repeating patterns; ignore unimportant details.
  • An algorithm is the step-by-step plan to solve the problem.

2Scratch blocks, variables & decisions

Scratch builds programs by snapping coloured blocks together — no typing. You control a sprite (a character) with blocks like move, turn and say.

Variables

A variable stores a value that can change while the program runs — perfect for a game score or a lives counter. Use set and change blocks to update it.

Decisions

Make choices with conditional blocks:

  • if-then — do something only when a condition is true.
  • if-then-else — do one thing if true, another if false.
if  score > 10  then
    say  "You win!"
else
    say  "Keep going"
Key points
  • Scratch snaps coloured blocks together; a sprite is a character you control (move, turn, say).
  • A variable stores a changing value (like a game score); set and change blocks update it.
  • if-then does something when a condition is true; if-then-else picks between two actions.

3Loops, sensing & games

Loops repeat blocks so you don't drag them many times:

LoopRepeats…
repeat (n)A fixed number of times
repeat untilUntil a condition becomes true
foreverEndlessly (great for games)

Sensing blocks

Sensing blocks let your program react to the player:

  • Keyboard — "when space key pressed".
  • Mouse — "when this sprite clicked".
  • Collisions — "if touching the wall / another sprite".

Put it together — loops + variables + sensing + decisions — and you can build an interactive game or story module.

Key points
  • repeat (n) loops a fixed number of times; repeat until loops until a condition is true; forever loops endlessly.
  • Sensing blocks react to the player: keyboard presses, mouse clicks and collisions (touching).
  • Combine loops + variables + sensing + decisions to make an interactive game.

★ Practical: plan a Scratch game

In Scratch (or on paper), plan a simple catch game:

  1. Use a 'score' variable that starts at 0.
  2. Use a forever loop so a falling object keeps moving.
  3. Use a sensing block: if the object touches the player, change score by 1.
  4. Use if-then-else: if score reaches 10, say 'You win!'.

Ready for the chapter test?

Answer 5 questions. Score 60% or more to mark this chapter complete.

Start the test →

💡 Log in to save your progress and earn the certificate.