tags:

views:

92

answers:

1

An algorithm of mine could be better readable if I could use a postcondition (do-until) loop instead of precondition (while) loop. Is there such a feature in Scala 2.8?

+5  A: 

Sure.

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 = ()
Daniel