Methods and Pattern Matching in Scala