Scala Language Do-While Loops


Example

var line = 0
var maximum_lines = 5

do {
  line = line + 1
  println("Line number: " + line)
} while (line < maximum_lines)

The do/while loop is infrequently used in functional programming, but can be used to work around the lack of support for the break/continue construct, as seen in other languages:

if(initial_condition) do if(filter) {
  ...
} while(continuation_condition)