In Scala, a block that contains a series of case expressions defines a partial function, thus:
val x: PartialFunction[Any,Int] = {case x: String => 1 case _: Any => 2}
Note that the type of x in the example must be specified because the input parameter to the partial function cannot be inferred. This would not be necessary in circumstances where there is enough information to infer the type, e.g.
def doit(f: PartialFunction[Any, Int]) = f("hi")
doit({case x: String => 1 case _: Any => 2})