val t = (1,true,"hello") t: (Int, Boolean, String) = (1,true,hello) println(t._1,t._2,t._3) println(t._1) println(t._2) println(t._3) 索引从1开始 遍历 t.productIterator.foreach(println) 1 true hello val t = 1 -> "a" t: (Int, String) = (1,a) println(t._1) println(t._2)