Work in Progress

Scala 3 has not been released, yet. We are still in the process of writing the documentation for Scala 3. You can help us to improve the documentation.

Are you searching for the Scala 2 documentation?

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 Martin Odersky has stated, 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: