article

In computer science, a function is said to produce a side effect if it modifies some state other than its return value. For example, a function might modify a global or a static variable, modify one of its arguments, write data to a display or file, or read some data from other side-effecting functions. Side effects often make a program's behavior more difficult to understand.

Imperative programming is known for employing side effects to make programs function. Functional programming in turn is known for its minimization of side effects.

Referential transparency


Being side-effect free is necessary but not sufficient for referential transparency. Referential transparency means that an expression (such as a function call) can be replaced with the value; this requires that the expression has no side effects and is pure (always returns the same results on the same input).

Programming constructs

Wirkung (Informatik) | Παρενέργεια (επιστήμη υπολογιστών) | 부수효과 (전산학) | 副作用 (プログラム) | Skutek uboczny (informatyka)

 

This article is licensed under the GNU Free Documentation License. It uses material from the "Side effect (computer science)".

Home Pageartsbusinesscomputersgameshealthhospitalshomekids & teensnewsphysiciansrecreationreferenceregionalscienceshoppingsocietysportsworld