What is the difference between a function and a subroutine?

I disagree. If you pass a parameter by reference to a function, you would be able to modify that value outside the scope of the function. Furthermore, functions do not have to return a value. Consider void some_func() in C. So the premises in the OP are invalid.

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. A function should not change the values of actual arguments whereas a subroutine could change them.

Thats my definition of them ;-)

Tags:

Terminology