Scala For loop
examples/ForLoop.scala
object ForLoop { def main(args:Array[String]) { val planets = List("Mercury", "Venus", "Earth", "Mars") for(name <- planets) println(name) for(name <- planets) { println(name) } } }
examples/ForLoopRange.scala
object ForLoopRange { def main(args:Array[String]) { for(i <- 10 to 1 by -1) { println(i) } } }