Quantcast
Channel: pattern matching
Viewing all articles
Browse latest Browse all 10

Scala best practice: Use match expressions and pattern matching

$
0
0

Scala best practice: Use match expressions and pattern matching

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 20.4, “Scala best practice: Use match expressions and pattern matching.”

Back to top

Problem

Match expressions (and pattern matching) are a major feature of the Scala programming language, and you want to see examples of the many ways to use them.

Back to top

Solution

Match expressions (match/case statements) and pattern matching are a major feature of the Scala language. If you’re coming to Scala from Java, the most obvious uses are:

Table of Contents

  1. Problem
  2. Solution
Back to top

Viewing all articles
Browse latest Browse all 10

Trending Articles