RosettaCodeData/Task/Loops-Do-while/Scala/loops-do-while-1.scala
2014-01-17 05:34:36 +00:00

8 lines
179 B
Scala

{
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(_))