Scala 3 — Book

Functional Programming

Language

Scala lets you write code in an object-oriented programming (OOP) style, a functional programming (FP) style, and also in a hybrid style—using both approaches in combination. As stated by Martin Odersky, the creator of Scala, the essence of Scala is a fusion of functional and object-oriented programming in a typed setting:

  • Functions for the logic
  • Objects for the modularity

This chapter assumes that you’re comfortable with OOP and less comfortable with FP, so it provides a gentle introduction to several main functional programming concepts:

  • What is functional programming?
  • Immutable values
  • Pure functions
  • Functions are values
  • Functional error handling

Contributors to this page: