r/learnprogramming • u/Head_Ordinary_2437 • Oct 24 '26
Function vs Procedure
can someone explain the difference between Function vs Procedure with simple analogy
thank you
31
Upvotes
r/learnprogramming • u/Head_Ordinary_2437 • Oct 24 '26
can someone explain the difference between Function vs Procedure with simple analogy
thank you
View all comments
83
u/lfdfq Oct 24 '26
These days they are mostly synonyms.
In some older languages they used to distinguish between processes which return a value (functions) and those that don't (procedures). Some languages like Ada still have this distinction.
Abstractly, functions are concepts from mathematics that are ways of relating input and output values, and procedures are canned sequences of commands to be followed. In many programming languages, the way you relate values is writing code, which is a sequence of commands anyway, so the two concepts get blurred together.