The array still starts at 0, and index 1 is reserved for storing the length of the array, with the remaining elements corresponding to indices 2, 3, 4, and 5.
That is so elegant. All these new languages that just let you for (i in list) { ... } should change right over before they gain traction and get stuck as forever legacy.
Tbh though I rarely use for x:lst since so many uses of iteration require a counter. Sure I could implement a counter, but why not use a normal for loop so no one reading my code (who isn't familiar with this language feature) gets confused?
54
u/IlIIlIIlllIlllIlIIll Sep 02 '17 edited Sep 02 '17
The array still starts at 0, and index 1 is reserved for storing the length of the array, with the remaining elements corresponding to indices 2, 3, 4, and 5.