Function (computer programming): Difference between revisions

Content deleted Content added
Meownium (talk | contribs)
m Move subprogram in accordance with edit 1231196675
fix grammar; reword more concisely; order somewhat chronological
Line 18:
==Terminology==
 
The meaning of each callable term, (function, procedure, method, and routine,...) is, in fact, different. They are not [[synonymous]]. Nevertheless, they each add a capability to programming that has commonality.
 
The term used tends to reflect the context in which it is used {{endash}} usually based on the language being used. For example:
 
* ''Subprogram'', ''routine'' and ''subroutine'' were more commonly used in the past but are less common today
* The terms ''routine,'' ''subroutine'' refer to the same meaning, but describe a hierarchical relationship, much like how a subdirectory is structurally subordinate to it's parent directory.
 
* The terms ''routine,Routine'' and ''subroutine'' referhave toessentially the same meaning, but describe a hierarchical relationship, much like how a subdirectory is structurally subordinate to it'sits parent [[Directory (computing)|directory.]]; ''program'' and ''subprogram'' are similarly related
* Some consider ''function'' to imply a [[Function (mathematics)|mathematical function]], acting upon the given inputs to return an output with no side-effects, but in many contexts a ''function'' simply refers to another callable section within the program.
 
* Some consider ''function'' to imply a [[Function (mathematics)|mathematical function]], acting upon the given inputs to return an output withhaving no side-effects, but in many contexts a ''function'' simply refers to anotherany callable section within the program.
* In the context of [[Visual Basic]], {{code|Sub}}, short for ''subroutine'' or ''subprocedure'', is the name of a callable that does not return a value whereas a {{code|Function}} does return a value -- much like [[Ada (programming language)|Ada]].
* ''Subprogram'' can be used to refer to a more generic, broad callable where multiple types of callables could exist (i.e., function and procedure), however, this term has fallen into antiquity in most spaces.
 
* [[Object-orientedIn programming|Object-oriented]]the languagescontext such asof [[CVisual Sharp (programming language)|C#Basic]] and [[JavaAda (programming language)|JavaAda]], use{{code|Sub}}, theshort termfor ''methodsubroutine'' toor refer''subprocedure'', tois the name of a membercallable functionthat ofdoes annot [[Objectreturn (computera science)|object]],value andwhereas maya act{{code|Function}} ondoes behalfreturn of thea object.value
 
* [[Object-oriented programming|Object-oriented]] languages such as [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]] use the term ''method'' to refer to a member function of an [[Object (computer science)|object]]
 
==History==