A sub-routine is a self-contained algorithm. It has an identifier, which is the name of the sub-routine. By using this identifier you can call the sub-routine from other code. Calling the sub-routine means that:
- the algorithm in the main code stops where it is
- the sub-routine runs
- at the end of the sub-routine, the algorithm returns to where it stopped in the main code.