Senin, 10 Januari 2011

Array Scala

$ cat array-test.scala

val pets = new Array[String](4)

pets(0) = "Tama"
pets(1) = "Shiro"
pets(2) = "Chako"
pets(3) = "Butchie"

for( i <- 0 to 3 ){ println( i + ": " + pets(i) ) } $ scala array-test.scala 0: Tama 1: Shiro 2: Chako 3: Butchie Sumber : http://sites.google.com/site/playingwithscala/home/getting-started/scala-script--basis/data/array

Tidak ada komentar:

Poskan Komentar