-
-
Save takkkun/5655347 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Nyan(name:String, age:Int) | |
val nyans:List[Nyan] = List(Nyan("ねこがた", 2), Nyan("うーねこ", 4)) | |
val has_wneko: PartialFunction[List[Nyan], Unit] = { | |
case Nil => println("うーねこのっといんざりすとなうよー") | |
case Nyan("うーねこ", _) :: _ => println("うーねこいんざりすとなうよー") | |
case _ :: rest => has_wneko(rest) | |
} | |
has_wneko(nyans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment