Subroutines

Introduction

What is a subroutine?

A subroutine is a named piece of code that can

Advantages

  • Allows the subroutine to be called in more than one place within the program
  • The subroutine can be tested independently
  • Allows modular development of the program
  • Allows a team of programmers to work independently on different components of a program
  • Reduces the duplication of code within a program
  • If there needs to be changes made (due to a bug etc) the changes can be made in on place.

Disadvantages

 

Functions vs Procedures

Procedures vs Functions

 

 

External Subroutines

External subroutines

  • External files
  • Importing in-built modules
  • External libraries