Scala contiguous match

Posted by drypot on Stack Overflow See other posts from Stack Overflow or by drypot
Published on 2010-04-10T05:06:46Z Indexed on 2010/04/10 5:13 UTC
Read the original article Hit count: 245

Filed under:
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 ?

© Stack Overflow or respective owner

Related posts about scala