Scala LanguagePattern Matching

Syntax

  • selector match partialFunction
  • selector match {list of case alternatives) // This is most common form of the above

Parameters

ParameterDetails
selectorThe expression whose value is being pattern-matched.
alternativesa list of case-delimited alternatives.

Related Examples

Guards (if expressions)