I want to do many case statements with same guard in front of each. Can I do it in way that doesn't require code duplication ?
"something" match {
case "a" if(variable) => println("a")
case "b" if(variable) => println("b")
// ...
}
I want to do many case statements with same guard in front of each. Can I do it in way that doesn't require code duplication ?
"something" match {
case "a" if(variable) => println("a")
case "b" if(variable) => println("b")
// ...
}