The wildcard pattern (_) matches any object whatsoever. You have already seen it used as a default, catch-all alternative, like this:
expr match {
case BinOp(op, left, right) => println(expr +” is a binary operation”)
case _ => }
The wildcard pattern (_) matches any object whatsoever. You have already seen it used as a default, catch-all alternative, like this:
expr match {
case BinOp(op, left, right) => println(expr +” is a binary operation”)
case _ => }