1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
object Test { def printList(in: List[String]): Unit = in match { case Nil => Unit case (s: String) :: Nil => println(s) case head :: (s: String) :: Nil => printList(head :: Nil) for(i <- head){ print(i) } println println(s) } }