As far as the ranged loop, I would expect a loop to iterate over the range specified, not the range minus one from the end. This seems intuitive to me.
is there a way to determine the minimum number of moves necessary? it would be nice to compare how one does
It catches me offguard too. For what it’s worth they have an inclusive range syntax as well:
for Index in 1..=5
{
do_something();
}
When I looked it up, the rationale given was because it was a 0 based indexing so most loops were of the form 0 to (length - 1), so they made the default range type non inclusive on the upper bound to make that simpler. It also mimic’ed the traditional for loop structure ( for(i=0; i<length; i++) => for i in 0 .. Length )
It’s a little loose for my taste, but I understand their thought process.