General
Purpose Packages
Automated
Systems
Commercial Data
Processing
Computer Systems
Hardware
Computer Systems
Software
Programming Course
Arrangements

Using Subroutines

Sub Routines

  1. Subroutines are small sections of code that make it easy to keep a program organised.
  2. A program can have millions of lines of code. Without breaking it into small sections it would be very hard to keep track of any mistakes that could occur in the code.
  3. Because programs can grow very large it is a good idea to add comments to allow a programmer to know the purpose of a piece of code. At the very least, get in the habit of automatically adding a comment as the first line of any subroutine that you create.

 

Play this video
Grabbing Data from the Form! Go Full Screen to see in greater detail?

1. Inputting Data from the Form To Do:-

  1. Watch Movie 8 which shows you how to grab data from a TextBox on your form.
  2.  Create the subroutine input_number for the Upto100 program and save all files as shown in the movie

 

 

 

 

 

Play this video
Processing the Data! Go Full Screen to see in greater detail?

2. Processing Data from the Form To Do:-

  1. Watch Movie 9 which shows you how to use or process the data from the form in a calculation.
  2. Create the subroutine calculate_number for the Upto100 program and save all files as shown in the movie.

 

 

 

 

 

Play this video
Displaying the Output from the processing! Go Full Screen to see in greater detail?

3. Outputting or Displaying Data in The Form To Do:-

  1. Watch Movie 10 which shows you how to display the results of the process or calculation.
  2. Create the subroutine display_results for the Upto100 program and save all files as shown in the movie.

 

 

 

 

 

What you have to do!

  1. Watch Movie 8 and create a Sub Routine called input_number which is used to grab data from the form.
  2. Watch Movie 9 and create a subroutine which processes the data from the form.
  3. Watch Movie 10 and create a final subroutine which display the results of the processing.

 

Mark off Exercise 6 in your progress grids.

 

What you should now be able to do!

 

Continue to Exercise 7: Running a Program

 


 

 

 

 

Home | S1 Topics | S2 Topics
Computing Standard Grade | Info Systems Intermediate II | Info Systems Higher | Internet Safety
Log into Glow | School Website | Contact Us