If someone could explain this behavior in plain english I would really appreciate it. Specifically, is there any difference between case _:Foo
and case Foo()
?
myvariable match {
case _: Foo => println("its a foo!")
case Foo() => println("It's also a Foo")
case Foo => println("Oops, this will *not* match a Foo! It will never be called")
case _ => println("This will be called for all unmatched items")
}