- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
How do I write a loop?
Created by admin on 2008-07-28.
Updated: 2008-07-28, 16:29
There are two ways for simple integer loops:
for
(i <- 1 to 1000000) { ... }
or
var
i = 1; while (i <= 1000000){ ...; i += 1 }
Both are fine, but in the current implementation the second one should be more efficient.