In the previous lesson, we were introduced to pattern matching in Scala. In this lesson, we will go over the types of patterns provided in Scala to see the true potential of pattern matching.
Wildcard
We saw the wildcard pattern _
in the previous lesson. It is a pattern which matches with any object. It is often used as a default pattern to avoid runtime errors.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy