In
computer science, a
function or
expression is said to have a
side effect if it modifies some
state or has an
observable interaction with calling functions or the outside world. For example, a particular function might modify a
global variable or
static variable, modify one of its arguments, raise an exception, write data to a display or file, read data, or call other side-effecting functions. In the presence of side effects, a program's behaviour may depend on history; that is, the order of evaluation matters. Understanding and debugging a function with side effects requires knowledge about the context and its possible histories.