What is functional programming?

Since functional programming is a paradigm, there are no absolute rules about what it is or is not. If you have to summarize it in one sentence, it might be that functional programming uses functions as the fundamental building block for constructing software. You might also see it said that functional programming treats functions as first-class objects. This means that functions are objects, just like lists or strings, that can be:

  • Stored in variables
  • Passed into other functions as parameters
  • Returned from other functions as a result

This leads to the idea of higher-order functions – that is, functions that operate on functions. Anything you can do with objects, you can do with functions.

An important cornerstone of functional programming is the idea of pure functions – functions that simply calculate a result without any other side effects.

Get hands-on with 1200+ tech skills courses.