previous | start | next

## Side Effects

- An externally observable effect of a function is called a side effect.
  - Displaying characters on the screen (including error messages).
  - Updating variables outside the functions.
  - Terminating the program.
- A function should leave no trace of its existence except for returning a value.
- Functions that print values become worthless in certain situations.
  - Graphics programs that have no output streams.
  - Programs where the user's language is not English.
  - Programs that don't want to print the value!
- Ideally, a function computes a single value and has no other side effect.

previous | start | next