Function (programming)
In programming, a function is a part of a program that can be called with certain arguments (or parameters) from inside the program or elsewhere, and returns a value. Although the term is related to the mathematical term it is less strict; a function may return different results each time, even if it is called with the same arguments, and a function may have side effects, that is, it may cause changes that remain after the call of the function has ended. Such functions can be mathematically modelled by incorporating a notion of time and global parameters. An exception to this difference is a function in pure functional programming that returns always the same result if called with the same arguments and has no side effects.
A procedure is similar to a function but has only side effects and does not return a value.
In some programming languages, such as ANSI C, where there are only functions there is often a type such as void
for the result of a function that has no result.