Sub routines

Once I eventually got my program to work in the way it was supposed to 😉 we looked at what a sub-routine is (also called a procedure). There were two sub routines in this program that took in pupil marks and then printed out an average, they are called:

  • fill_array
  • calculate_average

It is good to make use of sub-routines as they increase the maintainability of your program (i.e. other programmers can update your program easily).

These can be called (made to run) from any part of the program.  Click the notes below to see the program:

subroutines.jpg

Because this program makes use of subroutines so it is modular!

Advertisements

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: