iGCSE Computer Science - Distance Learning

Tutor Marked Assignment 6
Tutor Marked Assignment 8 (Programming)

Using Subroutines in Programming (2023 Specification Only)

In the 2020 specification for CIE iGCSE Computer Science, students are required to be aware of and be able to use subroutines that are provided for them. If you are sitting your exam on or before January 2023, this section will allow you to study some of the fundamentals currently seen in the GCSE courses. If you are sitting your exam from Summer 2023, this is now part of your course of study.

What is a Subroutine?

A subroutine is a block of code that exists outside of the main body of the program. This block of code is given a name and can be called upon multiple times (even though you only need to write the code once).

Task

A useful example of a subroutine is when validation is implemented where the same rule can be applied to multiple inputs. For example, if we wanted to apply a presence check to three inputs we could use the same validation code multiple times instead of re-writing it for each input.

Use the instructions in the code block below to write a presence check sub-routine: