The first part of the code below successfully stores a tuple in the value part of a Map. The second part is my attempt to store an array instead of a tuple. It does not work. What is wrong?
object MyClass {
def main(args: Array[String]) {
val m1 = Map("fname" -> (1,2), "lname" -> (3,4))
for ((k,v) <- m1) printf("key: %s, value: %s, 0: %s\n", k, v, v._1)
var states = scala.collection.mutable.Map[String, new Array[Int](3)]()
val states += ("fname" -> (1,2,3))
val states += ("lname" -> (4,5,6))
for ((k,v) <- states) printf("key: %s, value: %s, 0: %s\n", k, v, v._1)
}
}
Here are the errors I get.
Once I understand the syntax to do the job, I also want to access individual elements in the array.
