In computer programming, a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Subroutines are used to :
Below is a flowchart for our lighthouse which shows us how we can use a subroutine to make the lighthouse lamp flash by reusing the same flowchart.
Using the flowchart above create a subroutine called 'flashes' which makes the lighthouse lamp flash, see what the addition of the number below to our subroutine does to our mimic.
You should now be able to assess yourself against your objectives:
Software can be used to create sequences in a flowchart, to view onscreen simulations.
Starts or stops a process.
|Input or output||
An instruction or a command.
A decision, either yes or no. For example, a decision based on temperature that turns a central heating system on or off.
Connects the symbols. The arrow indicates direction.