What is the difference between a function and a subroutine? I was told that the difference between a function and a subroutine is as follows:
A function takes parameters
In terms of Visual Basic a subroutine is a set of instructions that carries out a well defined task. The instructions are placed within Sub
and End Sub
statements.
Functions are similar to subroutines, except that the functions return a value. Subroutines perform a task but do not report anything to the calling program. A function commonly carries out some calculations and reports the result to the caller.