Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 21:36, 15 August 2025 by 31.126.87.241 (talk) (replace link to Return with Function return)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A subroutine is a code block in a separate part of the source code.

This code block can be called, or 'invoked', and calling the subroutine will run the code in the code block.

Subroutines can take in parameters. These parameters give the subroutine more information about how to run and what values to act upon.

For example, a function addOne which simply returns the integer one above the value of the parameter we pass in, could take in an integer called num as a parameter.

Types of subroutines

edit edit source