I'm puzzled by the following observation. On the one hand, this works:
for i in 5..10:
echo i
But as soon as I store the slice in a variable, I can no longer iterate over it, i.e., this fails:
var slice = 5..10
for i in slice:
echo i
The error is type mismatch: got (Slice[system.int])
, and apparently there is no overloaded signature of the system.items
iterator for Slice[T]
. This raises the questions:
- Why does it work at all in the first case?
- Is there a workaround to iterate over a slice in the second case?