New
New
Year 8

User inputs and variables

I can use variables and user input to create interactivity in an app.

New
New
Year 8

User inputs and variables

I can use variables and user input to create interactivity in an app.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. Variables are used to store data.
  2. User input can be collected from elements.
  3. Stored values can be reused and combined to create dynamic outputs.

Keywords

  • Variable - a named piece of data stored in a memory location on a computer

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

  • Data type - the kind of information stored in a variable

Common misconception

Variables always store numbers.

Variables can store different types of data, including text (strings), numbers or Boolean values.


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

Pupils will have encountered many uses of apps in the world around them. Tailor the activities in the slides to best reflect the experiences pupils in your school will have had when using app-based technology.
Teacher tip

Equipment

Access to Code.org's App Lab or some other means of creating apps.

Licence

This content is © Oak National Academy Limited (2025), 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

Download quiz pdf

6 Questions

Q1.
What is the purpose of an event listener in an app?

to display images
to store app settings
Correct answer: to wait for something to happen and then run code
to update the app’s theme

Q2.
Which action is an example of an event in an app?

changing the device’s wallpaper
Correct answer: tapping a button
charging the battery
turning off Wi-Fi

Q3.
What does a function do in an app?

stores images
changes the screen’s brightness
connects to the internet
Correct answer: runs a set of instructions when called

Q4.
Put these actions in the correct order for responding to a key press:

1 - user presses a key
2 - event listener detects the action
3 - function runs code
4 - app updates display

Q5.
Match each example to the correct term:

Correct Answer:user taps a button,event

event

Correct Answer:code waiting for a swipe,event listener

event listener

Correct Answer:instructions to show a message,function

function

Q6.
What is the word for the action that causes an event to happen in an app?

Correct Answer: trigger, triggering

Assessment exit quiz

Download quiz pdf

6 Questions

Q1.
What is the term for a named storage location in a computer program that can hold different values?

Correct Answer: variable, variables

Q2.
What is a data type?

the name of an app
Correct answer: the kind of information stored in a variable
the colour of a button
the speed of the internet

Q3.
Match each example to the correct term:

Correct Answer:'yes' or 'no',Boolean

Boolean

Correct Answer:12345,number

number

Correct Answer:'username',text

text

Q4.
Which of these is NOT a valid use for a variable?

storing a username
storing a password
storing the number of clicks
Correct answer: displaying a picture

Q5.
What happens when a user enters data into a form and clicks 'submit'?

The app ignores the data.
The app closes.
Correct answer: The input is stored in a variable.
The app takes a screenshot.

Q6.
What is the term for information a user gives to an app?

Correct Answer: input