We have learned that it is better to break down large and
complex programming tasks into smaller ones that are easier to manage.
A programmer may define their own small sub-programs that can be 'called'
(run) from anywhere else in the program using a single instruction...and
as many times as necessary.
There are two types of user-defined sub-program
...
- Subroutine - which performs a
specific task...eg draws a box on screen
- Function - which returns an answer...eg
a mathematical calculation
Every subroutine has a name. The
subroutine can be called by using its name.
|