Created
January 24, 2015 04:18
-
-
Save shigemk2/487300e56b1831f37062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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