标签:ack next def com case hello any class less
package com.bjsxt.scala object Lesson_match { def main(args: Array[String]): Unit = { val tuple = (1,"hello",‘c‘,1.0,true) val iter = tuple.productIterator while(iter.hasNext){ val one = iter.next() MatchTest(one) } } def MatchTest(o:Any)= o match { case i:Int=>{println("type is Int")} case d:Double=>{println("typle is Double")} case 1=>{println("value is 1")} case ‘c‘=>{println("value is c")} case s:String=>{println("type is String")} case _=>{println("no match ... ")} } }
标签:ack next def com case hello any class less
原文地址:https://www.cnblogs.com/huiandong/p/9278284.html