How to access the variable “test” outside of the scala match expression? even i declare as var, it does not return the updated value for test variable.
val x: Int = 2
var test=null
x match {
case 1 => {var test=10}
case 2 => {var test=11}
}
println(test)