特牛生活网

Scala之模式匹配(Patterns Matching)_person is already defined as case class person cas-CSDN博客

网友收藏
文章浏览阅读1.5w次,点赞6次,收藏16次。前言首先,我们要在一开始强调一件很重要的事:Scala的模式匹配发生在但绝不仅限于发生在match case语句块中,这是Scala模式匹配之所以重要且有用的一个关键因素!我们会在文章的后半部分详细地讨论这一点。模式匹配的种类在Scala中一共有如下几种类型的模式匹配:通配符匹配(Wildcard Pattern Matching )常量匹配 (Constant Pattern Matching_person is already defined as case class person case class person(name:string