fork download
  1. object Main extends App {
  2. val l: List[Any] = List("Yes")
  3.  
  4. l match {
  5. case x: List[Int] => print(x.toString)
  6. case _ => print("Could not match")
  7. }
  8. }
  9.  
  10. // object Main extends App {
  11. // val l: Option[Any] = Some(1)
  12.  
  13. // l match {
  14. // case Some[Int](x) => print(x)
  15. // case _ => print("Could not match")
  16. // }
  17. // }
Success #stdin #stdout 0.36s 382016KB
stdin
Standard input is empty
stdout
List(Yes)