How do I write a loop?

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.

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland