Scala contiguous match
- by drypot
pathTokens match {
case List("post") => ("post", "index")
case List("search") => ("search", "index")
case List() => ("home", "index")
} match {
case (controller, action) => loadController(http, controller, action)
case _ => null
}
I wanted contiguous match. but got compile error. :(
(pathTokens match {
case List("post") => ("post", "index")
case List("search") => ("search", "index")
case List() => ("home", "index")
}) match {
case (controller, action) => loadController(http, controller, action)
case _ => null
}
When I wrapped first match with parenparenthesis, it worked ok.
Why I need parenthesis here ?