Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Lesson details

      Learning outcome

      I can update a variable based on the state of an input.

      Key learning points

      1. A variable's value can be changed according to a condition.
      2. Physical inputs can be tested as part of conditions in if...then...else statements.
      3. Checking the value of a variable doesn't change the variable's value.

      Keywords

      • Input - data that is sent to a program to be processed

      • Sensor - an input device that allows a computer to collect data from the physical environment

      • Variable - a named piece of data stored in a computer’s memory which can be accessed and changed by a computer program

      Common misconception

      Checking a variable changes its value.

      Reading a variable's value doesn't change it, only assigning it does.

      Teacher tip

      It is important to use physical demonstrations (like shaking a real micro:bit) alongside the emulator to show how sensors work.

      Equipment

      Pupils will need access to a device with block-based programming software that can be used to program a physcial controller. Examples in this lesson use Microsoft MakeCode https://oak.link/makecode

      Licence

      This content is © Oak National Academy Limited (2026), licensed on Open Government Licence version 3.0
      except where otherwise stated. See Oak's terms & conditions
      (Collection 2).

      Lesson video

      Loading...

      Prior knowledge starter quiz

      5 Questions

      Q1.
      What does a computer do when a condition in a program is met?

      ignores the commands
      Correct answer: runs a set of commands
      stops working
      deletes the program

      Q2.
      What is a condition in computing?

      a type of computer
      a statement that is always True
      Correct answer: a statement that can be True or False
      a kind of keyboard

      Q3.
      Which keyword describes the part of a program where a choice is made?

      Correct answer: selection
      loop
      output
      input

      Q4.
      Place these steps in the correct order for how a program checks a condition and acts:

      1 - check the condition
      2 - run the "then" commands if True
      3 - run the "else" commands if False
      4 - continue with the rest of the program

      Q5.
      Match the example to the correct keyword:

      Correct Answer:if...then...else,“if it’s raining, take an umbrella”

      “if it’s raining, take an umbrella”

      Correct Answer:condition,“the door is open: True or False?”

      “the door is open: True or False?”

      Correct Answer:flow,“first, then next, then last”

      “first, then next, then last”

      Correct Answer:selection,“choose what to do based on the weather”

      “choose what to do based on the weather”

      6 Questions

      Q1.
      What is the term for data sent into a program?

      Correct Answer: input

      Q2.
      What does a sensor do in a computer system?

      stores data
      changes the colour of the screen
      runs the program faster
      Correct answer: collects information from the environment

      Q3.
      What do we call a named piece of data that a program can change as it runs?

      Correct Answer: variable

      Q4.
      Which statement about variables is correct?

      a variable’s value can never be changed
      a variable is always a number
      variables are only used for storing text
      Correct answer: a variable can be updated by a program

      Q5.
      Match each keyword to its description:

      Correct Answer:sensor,a device that collects data from the environment

      a device that collects data from the environment

      Correct Answer:input,data sent to a program

      data sent to a program

      Correct Answer:variable,a named piece of data that can change

      a named piece of data that can change

      Correct Answer:condition,a rule checked by a program

      a rule checked by a program

      Q6.
      Arrange these steps in the correct order for using a variable in a program:

      1 - choose a name for the variable
      2 - assign a starting value to the variable
      3 - use the variable in the program
      4 - change the value of the variable when needed

      To help you plan your 6 computing lesson on: Sensing inputs, download all teaching resources for free and adapt to suit your pupils' needs...