Calling a routine

About this lesson: Calling a routine

In short

A procedure is a named group of steps. When the main program calls it, control jumps into the procedure, runs it, then returns to the line after the call. Step through.

Calling a routine

What you'll explore

Procedures: Jump in, run, jump back
A procedure is a named group of steps.
Functions: A routine that returns a value
A function sends a value back. area(4, 5) receives w = 4 and h = 5, returns 20, and the main program stores it. Change the values.
Why use routines?: Write once, use many times
Drawing three squares without a routine repeats the same code three times. With a routine it is written once and called three times.
Check yourself: Where next?
A program calls a procedure on line 8. The procedure finishes.

Also in this lesson

  • Common mix-ups
  • Routines
  • Dance routine

Words to know

routine
A named block of code: a procedure or function.
procedure
A routine that performs a task.
function
A routine that returns a value.
parameter
A variable that receives a value when a routine is called.
call
Run a routine by using its name.

Sources

  • BBC Bitesize KS3 Computer Science
  • Raspberry Pi Foundation, Computing curriculum resources

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 4 short steps and a 6-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 11 November 2026.

← Designing an algorithm: flowchart and pseudocode · Count-controlled loops in Python →

All lessons in Term 1 · Computing · Age 13