Overview

For loops

  • a to b: iteration range is $[a,b]$
  • a until b: iteration range is $[a, b-1]$

This is shown below.

for( i <- 0 to 5){
    println(i)
}
0
1
2
3
4
5
for( i <- 0 until 5){
    println(i)
}
0
1
2
3
4

References