"Pure" Functions

  • Methods that work like mathematical functions are often called "pure functions"
  • The method always returns the same output for the same input
    • The method can't rely on external sources of information (other than constants)
  • The method has no side effects
    • The method can't store information elsewhere
    • The method doesn't trigger other external processes
  • All behavior in the method is captured in parameters and the return value

4 / 23