Pattern matching is a mechanism for checking a value against a pattern. A successful match can also deconstruct a value into its constituent parts. It is a more powerful version of the
switch statement in Java and it can likewise be used in place of a series of if/else statements.
This is a companion discussion topic for the original entry at http://docs.scala-lang.org//tutorials/tour/pattern-matching.html.html