Parameters — Passing Data In
A parameter is a named variable in a subroutine definition that receives a value when the subroutine is called. The actual value passed is called an argument.
// 'name' is the PARAMETER (in the definition)
SUBROUTINE greet(name)
OUTPUT "Hello, " + name
ENDSUBROUTINE
// "Alice" is the ARGUMENT (the actual value passed)
greet("Alice") // Outputs: Hello, Alice
greet("Bob") // Outputs: Hello, Bob
Multiple Parameters
A subroutine can take multiple parameters, separated by commas. Arguments must be passed in the same order as the parameters.
SUBROUTINE printScoreCard(name, score, maxScore)
percentage ← (score / maxScore) * 100
OUTPUT name + " scored " + str(score) + "/" + str(maxScore)
OUTPUT "Percentage: " + str(percentage) + "%"
ENDSUBROUTINE
printScoreCard("Alice", 85, 100)
printScoreCard("Bob", 42, 60)
Passing by Value
In AQA, parameters are passed by value — a copy of the argument's value is made. Changes to the parameter inside the subroutine do NOT affect the original variable.
SUBROUTINE doubleIt(x)
x ← x * 2 // Changes the LOCAL copy of x
OUTPUT x // Outputs: 20
ENDSUBROUTINE
num ← 10
doubleIt(num)
OUTPUT num // Still 10 — the original is unchanged
Return Values
A function uses RETURN to send a computed value back to the caller. The return value can be stored in a variable, used in an expression, or used directly in OUTPUT.
SUBROUTINE power(base, exp)
result ← 1
FOR i ← 1 TO exp
result ← result * base
ENDFOR
RETURN result
ENDSUBROUTINE
OUTPUT power(2, 8) // 256
x ← power(3, 4) // x = 81
OUTPUT power(5, 2) + 1 // 26 — used in expression
Parameter vs Argument — Summary
| Term | Where? | Example |
| Parameter | In the subroutine definition | SUBROUTINE greet(name) |
| Argument | When calling the subroutine | greet("Alice") |
Worked Example — BMI Calculator
SUBROUTINE calcBMI(weight, height)
bmi ← weight / (height * height)
RETURN bmi
ENDSUBROUTINE
SUBROUTINE classifyBMI(bmi)
IF bmi < 18.5 THEN
OUTPUT "Underweight"
ELSEIF bmi < 25 THEN
OUTPUT "Healthy"
ELSEIF bmi < 30 THEN
OUTPUT "Overweight"
ELSE
OUTPUT "Obese"
ENDIF
ENDSUBROUTINE
w ← float(INPUT("Weight (kg): "))
h ← float(INPUT("Height (m): "))
myBMI ← calcBMI(w, h)
classifyBMI(myBMI)
Exam tip: Know the difference between parameter (in the definition — it is a placeholder) and argument (actual value passed when calling). AQA exams test whether changes inside a subroutine affect the original variable — the answer is no, because AQA uses pass by value.
⚠️ Common Mistakes
- Passing arguments in the wrong order — first argument goes to first parameter
- Assuming a procedure changes the original variable — pass by value makes a copy
- Forgetting to store or use the return value — calling a function without capturing the result
- Using the wrong number of arguments — must match the number of parameters