As a former Scala fan, wow you aren't kidding, wth
val month = i match
case 1 => "January"
case 2 => "February"
// more months here ...
case 11 => "November"
case 12 => "December"
case _ => "Invalid month" // the default, catch-all
// used for a side effect:
i match
case 1 | 3 | 5 | 7 | 9 => println("odd")
case 2 | 4 | 6 | 8 | 10 => println("even")
// a function written with 'match':
def isTrueInPerl(a: Matchable): Boolean = a match
case false | 0 | "" => false
case _ => trueSorry, I'm coming from C++-ish background - can anyone explain what's going on :)
It's been a while since I touched Scala but wasn't that a thing in previous versions, minus the braces not being present?