Monday, 5 December 2016

Subroutines


What is it?

A routine or subroutine also referred to as a function, procedure, and subprogram is a portion of code that may be called and executed anywhere in a program. For example, a routine may be used to save a file or display the time. Instead of writing the code for these commonly performed tasks, routines are made and called when these tasks need to be performed. 


What is the difference between a subroutine and a function?

In my mind, the difference between function and subroutine is semantic. That is to say some languages use different terminology. A function returns a value whereas a subroutine does not.

No comments:

Post a Comment