How to use closed ranges, and open-ended ranges
How to process portions of arrays or vectors using slices
The Ranges
We already saw a way to write a for loop :
But there is another possible way to write it:
This shows that the 0..12 clause is not a part of the for statement syntax, but it is an expression, whose value can be assigned to a variable. And that value can be used in for statements. The type of such value is named “range”.
Here is some more code using a range: