特牛生活网

Scala模式匹配类型_scala 类型匹配-CSDN博客

网友收藏
文章浏览阅读452次。说明:Scala模式匹配类型包括:常量、类型判断、数组、集合列表、元组、对象(样例类)等。匹配常量:Scala中,模式匹配可以匹配所有的常量,包括字符串,字符,数字,布尔值等。案例def main(args: Array[String]): Unit = { def describe(x: Any)= { x match { case 1=>"整数1" case "wan"=>"hello wan" case 12.5_scala 类型匹配