Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

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