Index of Array in Scala
(2016-01-31 23:47:21)
标签:
array |
分类: scala学习 |
val test=Array((1,2),(7,8))
test: Array[(Int, Int)] = Array((1,2), (7,8))
val m=test(1)
m: (Int, Int) = (7,8)//the Index is from 0
val n=test(1)._1
n: Int = 7//the Index is from 1
so,
val p=test(0)._1
p: Int = 1
test: Array[(Int, Int)] = Array((1,2), (7,8))
val m=test(1)
m: (Int, Int) = (7,8)//the Index is from 0
val n=test(1)._1
n: Int = 7//the Index is from 1
so,
val p=test(0)._1
p: Int = 1