Words do not contradict each other, but rather describe two possible aspects of the subroutine. An attempt to define the words follows:
Subprogram: A set of instructions that can be used several times in one program.
Function: A routine that returns a value. It is made from functions in mathematics ( wikipedia ).
Method:. A subprogram belonging to an object or class. May be a function.
I usually use the word “function” for each subprogram that has no side effects, but returns one clear value and the word “method” for each subprogram that has a side effect.
Jonatan Apr 03 2018-12-12T00: 00Z
source share