Skip to content

Instantly share code, notes, and snippets.

@iskandr
Created May 28, 2014 22:39
Show Gist options
  • Save iskandr/63648ce9001d7d955886 to your computer and use it in GitHub Desktop.
Save iskandr/63648ce9001d7d955886 to your computer and use it in GitHub Desktop.
object ForLoop {
def main(args: Array[String]) {
var acc = 0L
for (i <- 0L to 1000000000L) {
acc += i
}
println("For loop!")
}
}
object WhileLoop {
def main(args: Array[String]) {
var acc = 0L
var i = 0L
while (i <= 1000000000L) {
acc += i
i += 1
}
println("While loop!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment