Chapter 18Pattern Matching in Scala

by Venkat Subramaniam

You’ve seen some examples of Scala’s expressive and concise nature in Chapter 5, Creating Higher-Order Functions in Scala. Pattern matching is another area where you’ll appreciate the elegance of Scala. As you saw in Chapter 10, Patterns and Transformations in Elixir, pattern matching is a natural fit for functional programming, and Scala provides simple yet powerful facilities for pattern matching, as you’ll see in this chapter.

Get Functional Programming: A PragPub Anthology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.