Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Subprograms

Functions

301.12 Subprograms

Practise exam questions

Subprograms — Note 3 of 4

Return a value to program.

What you need to know

A function is a subprogram that calculates and returns a value using the return keyword. The returned value can be stored in a variable or used in an expression.

What to know

  • Uses return to send a value back
  • result = my_function() stores the returned value
  • Can return any type: int, str, bool, list
  • Function ends immediately when return is reached

Code examples

Function with return
python
def calculate_area(width, height):
    return width * height

area = calculate_area(5, 3)
print("Area: " + str(area))  # Area: 15
← Previous noteProcedures301.12 SubprogramsNext note →Scope + parameters301.12 Subprograms

Back to Subprograms

Specification notes for programming are in Paper 2.

Subprograms

Note 3 of 4

  1. 1Why subprograms
  2. 2Procedures
  3. 3Functions
  4. 4Scope + parameters
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).