読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

Scalaのtupple

Scala

最大で22の要素を突っ込めるとか

$  scala
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val t1 = ("Scala", 10)
t1: (String, Int) = (Scala,10)

scala>

scala> t1._1
res1: String = Scala

scala> t1._2
res2: Int = 10

scala> t1._3
<console>:9: error: value _3 is not a member of (String, Int)
              t1._3
                 ^

scala>