Homeschool Guide: These lesson plans are a guide for parents. Content may contain errors — always cross-reference with official exam board specifications.

subroutines

FoundationHigherAll Boards

4 detailed 50-minute lessons with teaching scripts, worked examples, parent guides, and assessment criteria.

Fastmail

Lesson Overview

Total Lessons: 4
Tier: Foundation and Higher
Duration: 50 minutes per lesson (200 minutes total)
Exam Boards: AQA, Edexcel, OCR, Eduqas, CCEA

Learning Objectives

Prerequisites

Materials & Equipment

Lesson 1: Introduction: subroutines

Duration: 50 minutes

Starter Activity (5 minutes)

Quick Recall

Write down everything you already know about subroutines. Then check against the key terms: A procedure, A function, Parameters. Use a mini-whiteboard or paper.

Main Content (35 minutes)

Parent/Teacher Guide:
Before lesson: Read the script below. Pre-teach key vocab: A procedure, A function, Parameters.
If stuck: Re-read the revision notes (link above), then break the content into smaller steps.
Extension: See the Stretch & Challenge ideas in Lesson 4.
Teaching Script (35 mins):
Mins 0-5 - Hook: "Today: subroutines. By the end you will be able to answer exam questions on it unaided. It connects to the rest of Computer Science because the ideas here recur across the spec."
Mins 5-20 - Direct Instruction: Work through the core ideas below one at a time; after each, ask your student to explain it back in their own words.
Mins 20-30 - Guided Practice: Model the worked example together, then let your student attempt the first practice question with guidance.
Mins 30-35 - Independent Practice: 2-3 practice questions from Lesson 3 below, with immediate feedback.
First Look

Start with the revision notes summary, then attempt: What is the difference between a procedure and a function?

Plenary (5 minutes)

Check Out

Your student states one thing they learned and one question they still have about subroutines.

Lesson 2: Core Concepts: subroutines

Duration: 50 minutes

Starter Activity (5 minutes)

Review Previous Lesson

Quick recap: write 3 key points from Lesson 1 on subroutines. Check them against the notes below.

Main Content (35 minutes)

Definition: A subroutine is a named, self-contained block of code that performs a specific task. It is defined once and can be called (invoked) from anywhere in the program. Subroutines make code more organised, reusable, and easier to debug.
A procedure: is a subroutine that performs a task but does not return a value to the calling code. It may produce output, change variables, or modify data structures, but it doesn't send a result back.
A function: is a subroutine that performs a calculation and returns a value to the calling code. The returned value can be stored in a variable, used in an expression, or output directly.
Parameters: are the variables listed in the subroutine definition. Arguments are the actual values passed to the subroutine when it is called. Parameters act as placeholders; arguments fill them with real data.
The RETURN statement: sends a value back from a function to the calling code. A function can only return one value, though that value could be an array or record. Once RETURN is executed, the function ends immediately.
Global variables: are accessible from anywhere in the program. Local variables exist only inside the subroutine where they are declared and cannot be accessed outside it.
TermMeaningExample
Returns a value?NoYes - must include RETURN
How to callAs a standalone statementAs part of an expression or assignment
Typical useDisplaying output, modifying dataCalculations, data lookups, conversions
ExampledisplayMenu()calculateAverage(80, 90, 70)
Where declaredInside a subroutineAt the top level of the program
Accessible fromOnly within that subroutineAnywhere in the program
LifetimeCreated and destroyed with each callExists for the entire program run
Risk of bugsLow - isolated scopeHigh - can be changed accidentally

Practice (10 minutes)

Q: What is the difference between a procedure and a function?

Answer: A procedure performs a task but does not return a value. A function performs a calculation and returns a value using the RETURN statement. Functions are used in expressions; procedures are called as standalone statements.

Plenary (5 minutes)

Explain Back

Your student teaches the key points back to you without looking. Fill any gaps immediately.

Lesson 3: Application: subroutines

Duration: 50 minutes

Starter Activity (5 minutes)

Quick Recall

Recall the key terms: A procedure, A function, Parameters. Define each in one sentence.

Main Content (35 minutes)

Parent/Teacher Guide: Let your student attempt each question alone first, then compare with the model answer. Award method marks for correct working even if the final answer is wrong.

Q1: What is the difference between a procedure and a function?

Answer: A procedure performs a task but does not return a value. A function performs a calculation and returns a value using the RETURN statement. Functions are used in expressions; procedures are called as standalone statements.

Q2: Write a function called calculatePerimeter that takes the length and width of a rectangle and returns the perimeter.

Answer: FUNCTION calculatePerimeter(length, width) perimeter ← 2 * (length + width) RETURN perimeter ENDFUNCTION

Q3: Explain the difference between a parameter and an argument.

Answer: Parameters are the variable names listed in the subroutine definition (placeholders). Arguments are the actual values passed to the subroutine when it is called. For example, in FUNCTION add(a, b), a and b are parameters; when calling add(3, 5), the values 3 and 5 are arguments.

Q4: What is the advantage of using local variables instead of global variables?

Answer: Local variables can only be accessed within the subroutine where they are declared, which prevents accidental modification from other parts of the program. This reduces bugs and makes the code more predictable and maintainable.

Q5: Write a procedure called displayGrade that takes a score and outputs "Pass" if the score is 50 or above, or "Fail" otherwise.

Answer: PROCEDURE displayGrade(score) IF score >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF ENDPROCEDURE

Plenary (5 minutes)

Error Review

Review any questions answered incorrectly. Identify whether the error was knowledge, method, or reading the question.

Lesson 4: Exam Practice: subroutines

Duration: 50 minutes

Starter Activity (5 minutes)

Command Words

Review what these command words require: state (one point), describe (say what happens), explain (say why), compare (both sides), evaluate (judgement).

Main Content (35 minutes)

Exam-Style Question

Attempt a past-paper style question on subroutines from the exam board past paper finder (see Resources), then mark it against the scheme.

Exam Tips: Functions MUST have a RETURN statement - procedures do not | Use the correct keywords: FUNCTION/ENDFUNCTION and PROCEDURE/ENDPROCEDURE | Parameters go in the subroutine header; arguments are passed when calling | Prefer local variables over global variables - explain why in exams | When asked about benefits of subroutines, mention: reusability, readability, debugging, teamwork, and maintainability | A RETURN statement immediately ends the function - no code after it will execute
Common Errors: ✗ Confusing parameters and arguments ✓ Parameters are the variables defined in the subroutine header; arguments are the actual values passed when the subroutine is called. ✗ Thinking procedures and functions are the same ✓ A function RETURNS a value; a procedure does NOT return a value. Use a function when you need a result back; use a procedure for actions like displaying output. ✗ Not understanding local vs global variable scope ✓ A local variable exists only inside the subroutine where it is declared. A global variable can be accessed anywhere. Local variables prevent accidental modification of data. ✗ Forgetting to use RETURN in a function ✓ A function must include a RETURN statement to
Stretch & Challenge (Grade 8-9):
  • Synoptic links: explain how subroutines connects to another Computer Science topic you have studied
  • Real-world: research one real-world use or example of subroutines
  • Critical: "What are the limitations of the models used in subroutines?"

Plenary (5 minutes)

Assessment Criteria
  • Got it: Confident explanation + correct worked examples
  • Getting there: Main points OK, needs support with detail
  • Not yet: Confused on key concepts - re-run Lesson 2

Homework & Consolidation

Recommended Resources

🎓 Smart Lesson (Guided)