object DI2 { def main(args:Array[String]){ for(i<- 1 to 10){println(i)} //變量名賦值 for(index@"link" <- List("af","hadoop","lik")){ println(index) } //查詢set中值是hadooop的鍵值 for((language,"hadoop") <- Set("scala"->"spark","hadoop"->"java")){ println(language) } //過濾集合中 值是數字類型的 for((k,v:Int) <- List(("spark"->12),("hadoop"->"dfdf"))){ println(k+v) } } }