I want to execute a statement before I match.
def test(x : Int) = x match {
doSomethingHere always
case 1 => println("1")
case 2 => println("2")
}
It has to be before, so I can’t just match on _ and execute at the end. It could go before I run test(), but I’d rather keep it inside the function.
Then say
which precisely and without boilerplate expresses what you’re trying to accomplish. Is there any issue here, beyond a stray {} pair?