Block-based programming

Block-based languages such as Scratch let you build programs by snapping blocks together. You cannot make spelling mistakes, so you can focus on the logic.

Practise this lesson free (6 questions)

More tools

Events and sequence

A Scratch script starts with an event block, such as when green flag clicked or when this sprite clicked.
The blocks underneath run in order, top to bottom: that is sequence.
Motion blocks move a sprite: move (10) steps, turn (15) degrees.

Loops

repeat (10) runs the blocks inside it 10 times.
forever runs them again and again until the program is stopped.
To draw a square with the pen: repeat (4) { move (100) steps, turn (90) degrees }.
For any regular shape, the turn is 360 ÷ number of sides.

Decisions and variables

if < > then runs blocks only when a condition is true, for example: if touching edge then say Ouch!
Variables store data, such as a score. Blocks like change [score] by (1) update them.
ask [What is your name?] and wait gets input; the reply is stored in answer.
Worked example

A sprite should draw a regular pentagon (5 sides). What should go inside the repeat loop?

  1. A pentagon has 5 sides, so repeat (5).
  2. Turn = 360 ÷ 5 = 72 degrees.

Answer: repeat (5) { move (100) steps, turn (72) degrees }

Key idea

Scripts start with an event block. Blocks run in sequence; repeat and forever loop; if blocks make decisions. For a regular shape, turn 360 ÷ sides degrees.

Key words
Sequence
Instructions carried out one after another, in order.
AND
A Boolean operator that gives True (1) only when both inputs are True.
Program
A set of instructions written in a programming language that a computer can run.
Condition
An expression that is either True or False, such as score > 50, used in if statements and while loops.
Input
Data put into a computer, for example from a keyboard, mouse, microphone or sensor.

All KS3 Computing key terms and definitions →

Quick check

Try two quick questions

See if it has sunk in. Answers are marked straight away.

Extra practice

2 more questions

Try each one, then tap to check.

  1. How many degrees should a sprite turn each time to draw a regular octagon (8 sides)?

    Show the answer

    Answer: 45 degrees

    The turns add up to 360°: 360 ÷ 8 = 45.

  2. How many degrees should a sprite turn each time to draw a regular square?

    Show the answer

    Answer: 90 degrees

    The turns add up to 360°: 360 ÷ 4 = 90.

Check you have got it

Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

Facts checked against the sources below, 27 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.

Related lessons