Reputation: 1587
I want to do something like:
myVar match{
case 0 => 1
case (myVar > 9) => 10
case _ => _
}
Is there a way to do this with match statements in scala?
Upvotes: 2
Views: 177
Reputation: 92016
myVar match {
case 0 => 1
case n if n > 9 => 10
case n => n
}
Upvotes: 9