GCSE · Computer Science · AQA · Spec 8525
Parameters
You hand a subroutine two numbers and, a moment later, a single answer comes back — and not one line inside the subroutine has changed. Follow the values and you will see exactly how they got in, and how the answer found its way home.
Computer Science · Subroutines
Two values in, one value out
Step the call and watch where each value goes.
Before you step: which value ends up in height, and what travels back out at the end?
1 SUBROUTINE rectangle_area(width, height)2 space ← width * height3 RETURN space4 ENDSUBROUTINE5 plot_length ← 76 plot_width ← 37 patio ← rectangle_area(plot_length, plot_width)8 OUTPUT patio
Variables
Output
Step 1: The calling routine builds its own values first. Nothing has travelled anywhere yet, and rectangle_area has not started.
Watch the variable panel. A name appears the moment a value lands in it.
AQA GCSE Computer Science (8525) §3.2.10 notes that although the terms arguments and parameters are both in use, examinable material uses the term parameter to refer to both. In a Paper 1 answer, 'parameter' is always safe.
Why parameters exist
Reason it through
Why does a subroutine need parameters at all?
First link · your turn
A subroutine is a named block of code that the program can reach by name. What happens the second time you call it?
Predict, then check
The order the values are written in the call is the whole question.
A subroutine is defined as SUBROUTINE share(total, people), and its body is RETURN total / people. The calling routine sets p ← 4 and q ← 20, then runs result ← share(p, q). What does result end up holding?
Answering a describe question
What a full answer has to contain
Read the answer and decide what it earns before you tap anything. Then check each requirement in turn.
Question
Describe how data is passed into a subroutine and how a result is passed back out. [4 marks]
Student answer
The values the subroutine needs are written in the brackets of the call, and they land in the parameters listed in the subroutine's header. The subroutine then works with those parameters instead of the caller's variables. When it has finished it uses RETURN to send the result back to the calling routine.
AQA GCSE Computer Science (8525) §3.2.10 requires you to describe how data is passed to a subroutine using parameters and out of a subroutine using return values, and to handle subroutines that need more than one parameter. This is Paper 1 content.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
How a subroutine takes data in, and how it hands a result back out.
What you need to know
- Data is passed into a subroutine through its parameters — the names listed in the subroutine's header.
- The values written inside the brackets of the call fill those parameters, matched to them in the order they are written.
- A subroutine can require more than one parameter; position, not name, decides which value lands where, so a call written in the wrong order gives a wrong answer rather than an error.
- Data is passed out of a subroutine using a return value, which is handed back to the exact point where the call was made and can then be stored or used.
- The value written in the call is sometimes called an argument and the name in the header the parameter; course material commonly uses 'parameter' for both.
The big picture
Parameters and return values are the two routes in and out of a subroutine: the values written in the call land in the parameters, matched by position, and RETURN hands one result back to the exact point where the call was made.
Key points
Worked example
Problem
A subroutine is defined as SUBROUTINE total_cost(price, quantity), and its body is RETURN price * quantity. The calling routine runs cost_a ← total_cost(6, 4) and then cost_b ← total_cost(9, 2). State what cost_a and cost_b hold, and explain how one subroutine produced two different answers.
⚠ Watch out
Assuming a value lands in the parameter whose name matches. It does not. The call's values are matched to the parameters by position, so writing them in the wrong order silently produces a wrong answer instead of an error — which is why it is so easy to miss.
Memory hook
IN through the brackets, OUT through the RETURN. The brackets are the doorway in; the return value is the doorway out.
Check yourself
Without looking back: how does a value get into a subroutine, and how does a result get back out? Then say what decides which value lands in which parameter.
Flashcards
(7)How does data get INTO a subroutine?
How does data get OUT of a subroutine?
A subroutine has two parameters. How does it know which value is which?
What is the difference between an argument and a parameter?
Why does a subroutine need parameters at all?
What is the difference between RETURN and OUTPUT?
Describe how data is passed to and out of a subroutine.
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.