Pearson Edexcel GCSE Computer Science (1CP2)Specification point 1.1.2

Edexcel 1CP2 1.1.2: Benefits of subprograms

The free BugBot lesson that teach this point, a robot to try it on, and the past-paper questions that test it.

What it covers

You have been calling functions since lesson F1.3: print, forward, distance. Now you write your own. A function is a named block of code you can run whenever you like, as often as you like, by calling its name. Exams call it a subprogram.

  • Defining a function
  • Define first, then call
  • What happens when a function is called
  • A function can call other functions
  • Why write functions?
Read the free lesson (12 min)

Or do it in the simulator, with tasks that mark themselves

Lessons that teach it

  1. F4.1 Writing functions Functions and structured code
    def, calling, and why subprograms help.

Try it on a robot

The task from F4.1 Writing functions, running here. Change the program and press Run.

Past paper questions on this

Real exam questions that test this, each worked through with a program you can run.

The specification is Edexcel's own document; this page says which of our lessons teach point 1.1.2 and is not endorsed by the board.