Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 725 Bytes

File metadata and controls

27 lines (18 loc) · 725 Bytes

Functional Programming

What is Functional Programming?

Pure Functions

Pure Functions are very simple functions that only operate on their input parameters.

function add(x, y) {
    return x + y;
}
  • Most useful Pure Functions must take at least one parameter
  • All useful Pure Functions must return something
  • Pure Functions will always produce the same output given the same inputs
  • Pure functions have no side effects

Immutability

  • There are no variables in Functional Programming
  • Functional Programming uses recursion to do looping

Higher-Order Functions

  • In Functional Programming, a function is a first-class citizen of the language. In other words, a function is just another value