10.1) Subroutines
Subroutines
are like functions
in that part of the main program is separated off in a sub task and solved. The results are then returned to the main code and the program proceeds. Whereas functions
are used to calculate a single value to return to the program, a subroutine
is more general and is used to modify numerous variables. This is the most important difference.
Subroutines
can help make programs clearer to read, break tasks down into manageable chunks, and it can be useful to create subroutines
so that the code can be reused for other purposed without rewriting it.
Please see the next page for an example of a subroutine
and a video explaining it.