I learn something new every day. I have an array of indices. They way I would normally access each of the array elements referenced by the indices is this:
for index in offsets
{
let item = items[index]
...do something with 'item'...
}
Yesterday, I learned that I could do this:
offsets.forEach
{ index in
let item = items[index]
...do something with 'item'...
}
So my question is, is either one of these methods better than the other, or are they equivalent?
Always trying to learn.