I just guess since I am not a scala expert, but according to the documentation for the Any class in scala, I think that since null is not an object, it is not the result of Any and, as such, does not match the first case specified.
Adding sample code below. It prints "something else" at startup.
val x = (2, null) x match { case (i:Int, v:Any) => println("got tuple %s: %s".format(i, v)) case (i:Int, null) => println("something else %s".format(i)) case _ => println("catch all") }
After additional research, it seems that zero should match any value of the documentation , says that it extends AnyRef, which extends Any.
EDIT: Like everyone else. The first case does not correspond to a zero value. It is listed in the documentation.
Brian hasden
source share