快學Scala-09--模式匹配

1.匹配字符串 A => 1  B => 2  C=> 3 //傳統方法 def getNum(msg:String):Int={ if(msg=="A") 1 else if (msg=="B") 2 else if (msg=="C") 3 else 4 } //模式匹配方法 def getNum(msg:String):Int={ msg match
相關文章
相關標籤/搜索