O'Reilly logo
  • Yan Ren thinks this is interesting:

Scala equivalent

From

Cover of Scala for the Impatient, Second Edition

Note

scala> 10.to(0, -1) res45: scala.collection.immutable.Range.Inclusive = Range 10 to 0 by -1

scala> for (i <- res45) { println(i) } 10 9 8 7 6 5 4 3 2 1 0