package com.bjsxt.scala
object Lesson_match {
def main(args:Array[String]):Unit={
val tuple=("1","abc",'c',1.1,true)
val iter=tuple.productIterator
while(iter.hasNext){
matchTest(iter.next())
}
}
def matchTest(o:Any)={
o match {
case i:Int=>println("type is Int,value is "+ i)
case 1=>println("value is 1")
case s:String=>println("type is String,value is "+ s)
case c:Char=>println("type is char,value is "+ c)
case d:Double=>println("type is Double,value is "+ d)
case _=>println("no match... ")
}
}
}