Set and change variable blocks
A variable block that stores a starting value in score. Use change score by 1 to add to it, or by -1 to take away, so the score counts up or down.
Understanding Set and change variable blocks in Years 5–6 Creating Digital Solutions
What it does: A negative number in the change block subtracts from the variable, so the value counts down. 'set score to 0' replaces whatever was stored with 0. 'change score by 1' would just add one more point. Set the starting value once at the beginning. If it was inside the loop, the score would reset to 0 each time. Set overwrites the value, while change adds to the current value, so only change can keep a running total.
Common mistakes: The change block adds to a variable, so it must say 'by'. It should be 'change score by 1'. The word 'to' belongs in the set block. The set block stores a starting value, so it uses 'to'. It should be 'set score to 0'. The word 'by' belongs in the change block.
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 51–60) and word search (Modules 41–74).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
set score to 0Fill in the Blanks
Spot the Error
Student with a class code? Join your class →