I have below use case, I know how pattern matching works in Scala but I have a requirement where I need to assign values based on the pattern, I wanted to avoid repeating code, Is there best way I can achieve this? Please let me know
sample value for test value will be a string with delimitor ','
cf match {
case "1" =>
val info1 => test.split(",")
val info2 => test2.split(",")
val info3 => test3.split(",")
val info4 => test4.split(",")
val info5 => test5.split(",")
case "2" =>
val info1 => test6.split(",")
val info2 => test7.split(",")
val info3 => test8.split(",")
val info4 => test9.split(",")
val info5 => test10.split(",")
}
Thanks in advance