Jump to content

Function (programming): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
mNo edit summary
merge it to subprogram
Line 1: Line 1:
#REDIRECT [[subprogram]]
[[nl:functie (informatica)]]
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-effect (computer science)|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: see [[denotational semantics]] for a fuller treatment of this subject.

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 language]]s, such as [[ANSI C]], where there are only functions there is often a type such as <code>void</code> for the result of a function that has no result.

Revision as of 20:35, 17 May 2003

Redirect to: