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 * height
3 RETURN space
4 ENDSUBROUTINE
5 plot_length ← 7
6 plot_width ← 3
7 patio ← rectangle_area(plot_length, plot_width)
8 OUTPUT patio

Variables

plot_length=7

Output

 

Step 1: The calling routine builds its own values first. Nothing has travelled anywhere yet, and rectangle_area has not started.

1 / 8

Watch the variable panel. A name appears the moment a value lands in it.

Step 1 of 8: The calling routine builds its own values first. Nothing has travelled anywhere yet, and rectangle_area has not started..

Exam line: Two routes, and you need both of them by name: parameters carry data in, and the return value carries a result out.
Watch out: The names at the call site and the names in the header do not have to match, and are never matched up by name. The first value goes to the first parameter, the second to the second.

Two routes, one subroutine

ParametersvsReturn value

Both move data. The direction of travel is what separates them.

Focus

Direction of travel

Parameters

Inwards — the calling routine supplies values and the subroutine receives them.

Return value

Outwards — the subroutine supplies a result and the calling routine receives it.

The insight

This is the whole difference. Decide which way the data is moving and you have already named the mechanism.

Where it is written

Parameters

Inside the brackets — as names in the subroutine's header, and as values in the call.

Return value

After the keyword RETURN, inside the body of the subroutine.

How many

Parameters

As many as the job needs — two, three or more, separated by commas and matched to the call's values in order.

Return value

One value per RETURN statement: the single result the calling routine asked for.

What the calling routine sees

Parameters

It writes the values it wants used. It never needs to know what the parameters are called.

Return value

It receives the value and can store it, display it or use it in a calculation.

What it is called

Parameters

The names in the header are the parameters; the values written in the call are sometimes called arguments.

Return value

The value handed back is the return value.

UK note

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?

Link 1 of 4

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?

2
Locked — reveal the link above first
3
Locked — reveal the link above first
4
Locked — reveal the link above first

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.

Describe question · 4 marks0/4
UK note

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

1Parameters are the way in; the return value is the way out.
2Position decides: first value to the first parameter, second value to the second.
3The names at the call site and the names in the header do not have to match, and are never matched by name.
4RETURN hands a value back to the caller; OUTPUT only displays one.
5One subroutine serves many callers because each call supplies its own values and collects its own result.

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?
Through its parameters — the names listed in the subroutine's header. The call writes values inside its brackets, and those values fill the parameters.
How does data get OUT of a subroutine?
Through a return value. RETURN hands one value back to the exact point where the call was made, and the calling routine can then store or use it.
A subroutine has two parameters. How does it know which value is which?
By position. The first value written in the call fills the first parameter and the second fills the second. The names used at the call site make no difference.
What is the difference between an argument and a parameter?
The argument is the value written in the call; the parameter is the named slot in the header that receives it. Course material commonly uses 'parameter' for both.
Why does a subroutine need parameters at all?
So that one named block of code can work on different data every time it is called, instead of being stuck with values fixed inside it.
What is the difference between RETURN and OUTPUT?
RETURN hands a value back to the calling routine, which can use it. OUTPUT displays a value on the screen and hands nothing back.
Describe how data is passed to and out of a subroutine.
Values written in the call are passed in and land in the parameters, matched in the order they are written; a result is passed back out as a return value.

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 posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

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.