17 Loops using while
Scala doesn’t have a “classic” equivalent to the imperative for loop construct that exists in c, Java, etc. For imperative “for” like loops, use while
.
Scala doesn’t support (out of the box) the ++
and --
operators, use += 1
or -= 1
for the same effect.