GCSE · Computer Science · AQA · Spec 8525

Parameters

Your average subroutine can average 4, 10 and 7. Now make it average 13, 10 and 7 without touching a line inside it. That's what parameters do. Watch.

Computer Science · Subroutines

Three values in, one average out

Step through both calls and watch where each value goes.

Before you step: when average is called the first time, which value will C hold?

1 SUBROUTINE average(A, B, C)
2 total ← A + B + C
3 OUTPUT total / 3
4 ENDSUBROUTINE
5 num1 ← 4
6 num2 ← 10
7 num3 ← 7
8 average(num1, num2, num3)
9 num1 ← 13
10 average(num1, num2, num3)

Variables

Output

 

Step 1: The definition. A, B and C are declared as parameters: three named slots, waiting for values. Nothing runs yet.

1 / 12

Watch the variable panel. A, B and C only appear once the call has handed them their values.

Step 1 of 12: The definition. A, B and C are declared as parameters: three named slots, waiting for values. Nothing runs yet..

Exam line: Parameters are declared in the definition. The call supplies the arguments, and their values are passed in at the moment of the call.
Watch out: num1 and A are different names, and that's fine. What has to match is the count: three parameters, so every call supplies three arguments.

Why parameters exist

?

Reason it through

Why does a subroutine need parameters at all?

Link 1 of 4

First link · your turn

Picture average with 4, 10 and 7 typed straight into its body. What happens every 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

Think about what actually gets handed over at the call.

SUBROUTINE show(a, b) is called as show(num1, num2). Just before the call, num1 holds 6 and num2 holds 9. Inside show, what does b hold?

Which do you believe?

Do the names have to match?

A program contains SUBROUTINE average(A, B, C). Later it runs average(num1, num2, num3).

Which is closest to what you think right now?
How sure are you?

Exam line: The call can use any names it likes, as long as it supplies one argument for every parameter.

UK note

AQA GCSE Computer Science (8525) §3.2.10: examinable material uses the word 'parameter' for both the names in the definition and the values in the call, so 'parameter' is always safe in an answer. 'Argument' is just the more precise word for the call side.

Find the faulty line

One argument short

Kai's program should output the volume of a box. One line is wrong. Which one?

Kai's program — which line goes wrong?

Exam line: Count the parameters in the definition, then count the arguments in the call. They must be equal.

Your turn

Write the definition line and the call

A subroutine called area needs to be given a length and a width. Write the first line of its definition, then write a call that hands it the values stored in the variables room_length and room_width. [3 marks]

0 words · your answer stays on this page and is not sent anywhere.

Exam line: Parameters go in the definition's brackets; arguments go in the call's brackets, one for each parameter.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

How a subroutine gets handed the values it needs, and why the names don't have to match.

What you need to know

  • Parameters are declared in a subroutine's definition, so it can receive values from the code that calls it.
  • A subroutine's parameters set out what data has to be handed to it every time it's called.
  • Calling a subroutine hands control to it, plus any arguments: the values written inside the call's brackets.
  • Have a goLook at the call total(x, y). Which parts are the arguments, and which part is just the subroutine's name?

    x and y are the arguments; total is the name.

    Arguments are the values written inside the call's brackets. The name outside the brackets says which subroutine to hand control to.

  • At the moment of the call, each argument's value is passed across into a parameter.
  • Inside the subroutine, each parameter behaves like a local variable holding the value it was given.
  • Have a goSUBROUTINE double(n) is called as double(score) while score holds 8. Inside double, what does n hold?

    8

    The value in score is passed into n at the call. n holds that number like a local variable, not the word 'score'.

  • A subroutine can have no parameters, one parameter, or several.
  • Argument names don't have to match parameter names: average(num1, num2, num3) works fine with parameters A, B and C.
  • What does have to match is the count: the call supplies exactly as many arguments as there are parameters.
  • Have a goYour mate swears average(x, y) will work for SUBROUTINE average(A, B, C), 'because names don't matter anyway'. They're half right. Which half is wrong?

    The count: three parameters need three arguments, and this call gives two.

    Names really can differ, but that rule says nothing about how many. The call must still supply exactly as many arguments as there are parameters.

  • You'll often see 'parameter' used for the call's values too. That's fine; 'argument' is just more precise.

The big picture

Parameters are declared in a subroutine's definition so it can receive values from the code that calls it. A call hands over control plus its arguments; at that moment each argument's value is passed into a parameter, which then behaves like a local variable. The names can differ, but the call must supply exactly as many arguments as there are parameters.

Key points

1Parameters are declared in the definition, ready to receive values from the caller.
2A call hands over control and its arguments; each argument's value is passed into a parameter at that moment.
3Inside the subroutine, a parameter works like a local variable.
4Names can differ between call and definition; the number of arguments and parameters must match.
5Zero, one or several parameters are all allowed.

Worked example

Problem

SUBROUTINE rectangle(width, height) has the body OUTPUT width * height. The main program sets plot_length ← 7 and plot_width ← 3, then runs rectangle(plot_length, plot_width). Check that the call is valid, say what width and height hold, and state what is output.

⚠ Watch out

Thinking the arguments in a call must share the parameters' names. They don't: average(num1, num2, num3) fills A, B and C perfectly well. What has to match is the count, so average(num1, num2) is wrong, and the names were never the problem.

🧠

Memory hook

Different names, same count. The names can be anything; the number can't.

✓

Check yourself

Cover the page. Say where parameters are declared, what happens to each argument's value at the moment of the call, and the one thing about its arguments every call has to get right.

Flashcards

(12)
Where are a subroutine's parameters declared?
In the subroutine's definition, e.g. SUBROUTINE average(A, B, C).
What do parameters allow a subroutine to do?
Receive values from the code that calls it.
What does a subroutine's parameter list tell someone who wants to call it?
What data has to be handed to the subroutine every time it is called.
What two things does calling a subroutine hand over?
Control (the program moves into the subroutine) and any arguments.
What is an argument?
A value written inside the brackets of a call, e.g. num1 in average(num1, num2, num3).
When are the arguments' values passed into the parameters?
At the moment of the call.
How does a parameter behave inside its subroutine?
Like a local variable, holding the value it was given.
How many parameters can a subroutine have?
None, one, or several.
Must argument names match parameter names?
No. average(num1, num2, num3) works fine with parameters A, B and C.
SUBROUTINE average(A, B, C): how many arguments must a call supply?
Exactly three, one for each parameter.
Parameters a and b; call made with num1 and num2. What lands in a and b?
The values stored in num1 and num2.
Is it wrong to call a value in a call a 'parameter'?
No. 'Parameter' is widely used for both; 'argument' is just the more precise word for the call side.

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 31 October 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.