Is there a do-until (postcondition) loop in Scala 2.8?

My algorithm may be more readable if I can use the postcondition (do-until) loop instead of the precondition (while) loop. Is there such a feature in Scala 2.8?

+5
source share
1 answer

Of course.

scala> var i = 0
i: Int#4363 = 0

scala> do {
     | println(i)
     | i += 1
     | } while (i < 10)
0
1
2
3
4
5
6
7
8
9
res0: Unit#3773 = ()
+11
source

All Articles