RosettaCodeData/Task/Loops-Do-while/Scala/loops-do-while-1.scala

9 lines
179 B
Scala
Raw Permalink Normal View History

2014-01-17 05:32:22 +00:00
{
var (x, l) = (0, List[Int]())
do {
x += 1
l :+= x // A new copy of this list with List(x) appended.
} while (x % 6 != 0)
l
}.foreach(println(_))