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

countdown(n: Int)

From

Cover of Scala for the Impatient, Second Edition

Note

scala> def countdown(n: Int) = for (i: Int <- n.to(0, -1)) {println(i)} countdown: (n: Int)Unit

scala> countdown(10) 10 9 8 7 6 5 4 3 2 1 0