title | type | description | languages | num | previous-page | next-page | ||
---|---|---|---|---|---|---|---|---|
Functional Programming | chapter | This chapter provides an introduction to functional programming in Scala 3. |
| 41 | collections-summary | fp-what-is-fp |
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