Simple question about tuple of scala

Viewed 25211

I'm new to scala, and what I'm learning is tuple.

I can define a tuple as following, and get the items:

val tuple = ("Mike", 40, "New York")
println("Name: " + tuple._1)
println("Age: " + tuple._2)
println("City: " + tuple._3)

My question is:

  1. How to get the length of a tuple?
  2. Is tuple mutable? Can I modify its items?
  3. Is there any other useful operation we can do on a tuple?

Thanks in advance!

8 Answers
Related