Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created January 24, 2015 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/487300e56b1831f37062 to your computer and use it in GitHub Desktop.
Save shigemk2/487300e56b1831f37062 to your computer and use it in GitHub Desktop.
val r1 = 1 to 10
println(r1)
println("---------")
val r2 = 1 to 10 by 2
println(r2)
println("---------")
val r3 = 1 to 10 by 3
println(r3)
println("---------")
for (i <- 1 to 5) println(i)
println("---------")
for (i <- 1 until 5) println(i)
println("---------")
// val x1 :Array[Int] = 1 to 10 toArray
val x1 = 1 to 10 toArray
for (i <- 0 until x1.length) println(x1(i))
println("---------")
val x2 = 1 to 10 toList
for (i <- 0 until x2.length) println(x1(i))
println("---------")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment