Computing · Year 5

Variables in Action

💻 ComputingHard18 min
0
0 of 6

🎮 you are a . The your : 3. You into a pitnow it 2. You a now it 3 again. How does the that and it? The is a . A is a box a that can a of and that can be as the . , every would do the thing every . are what make , , and .

The ' from the ', to . In you use toox and y in . In the is the : a that to a which can .

Every has things: a , a , and a . The is by the it should what is , like ' or '. The is the the box now, for 10 or the '. The the what of to : a (), a , or a of (called a ). a — 'x' you , but ' you what is .

Variable nameExample valueData type
score250Integer (whole number)
playerNameAmaraString (text)
speed3.5Decimal number
livesRemaining3Integer (whole number)
levelCompleteTrueBoolean (true/false)
Examples of variables and their types

A can only one of two : or . It is after . You use a called 'when it to , the the . Very for just one bit of ! 💡

🔗 Match each computing term to its correct meaning. Drag each term to its definition.

  • Variable

  • Integer

  • String

  • Boolean

  • Data type

🔄 A on . , set the up with a before the it, for set = 0. , the during the , for set = + 10. that the is , then into the box. , use the to it, it, or make a with it, for 'if > 100 then . these by you what a will do.

🧩 A simple quiz game runs these steps. Put them in the correct order from first to last. ⬇️

  1. Use: display the final score on screen
  2. If answer is correct, update: set score = score + 1
  3. Check the player's answer
  4. Ask the player a question
  5. Initialise: set score = 0

do far more than . They can a so the ' done, !' of just ' done!'. They can a if = 3 then . They can a , or which the . a needs to and it , a is the . This is why even a use or six all .

⚠️ out for ! If you a before it a , the may or . your at the of your it is a key .

🗂️ Sort each example into the correct category: is the program initialising a variable, updating it, or using it? 🗂️

  • Set lives = 3 at the start of the game

  • Set score = score + 50 when a coin is collected

  • Display the current value of score on the screen

  • Set playerName = 'Amara' when the player types their name

  • Set lives = lives - 1 when the player loses a round

  • If lives = 0 then show the Game Over screen

🧠 a every by and the of each after each . It is one of the most in . you where the is not what you before you run the . this a . When you , jot a with the in one and its after each in the . Even if the is , the of about how .

✍️ Complete the sentences about variables using the words in the word bank. 📝

A is a that a . The called . When you a its you it. To a by and you a .

Quiz time! 📝

Variables in Action — Check Your Knowledge ✅

Question 1 of 5

Tip: log in to save your score and track progress.

What is a in a ?

Finished?

Log in to mark this lesson complete and track your progress.