val pair = (99, "hello")
println(pair._1)
A tuple can't access the elements like a list, for example, with "pair(0)".
The reason i stat a list's apply method always returns the same type, but each element of a tuple may be a different type.
These _N numbers are one-based, instead of zero_based, because starting with 1 is a tradition set by other languages with statically typed tuples, such as Haskell and ML.
No comments:
Post a Comment