Scala - pattern matching with conditional statements?

Viewed 12108

Is it possible to do something like:

def foo(x: Int): Boolean = {
    case x > 1 => true
    case x < 1 => false
}
3 Answers
Related