8 ms·
Pattern matching is common in functional languages like Haskell or Scala. It's like a form of overloading on steroids, letting you inspect the values and struct
by natefaubion 14y ago
Pattern matching is common in functional languages like Haskell or Scala. It's like a form of overloading on steroids, letting you inspect the values and structure of the arguments passed to your function (with a very terse syntax), and do different things based on that criteria. It can also take care of a lot of boilerplate like splitting an array into different parts or extracting values from a configuration object.