How do you code up a pattern matching block in scala?

Posted by egervari on Stack Overflow See other posts from Stack Overflow or by egervari
Published on 2010-05-10T04:53:48Z Indexed on 2010/05/10 4:58 UTC
Read the original article Hit count: 319

Filed under:
|
|
|

How do you code a function that takes in a block of code that contains case statements? For instance, in my block of code, I don't want to code a match or a default case... looking something like this

myApi {
    case Whatever() => // code for case 1
    case SomethingElse() => // code for case 2
}

And inside of my myApi(), it'll actually do the matches. Help?

© Stack Overflow or respective owner

Related posts about scala

Related posts about pattern