This is also a pretty good coding tip.
Especially when it involves multiple indexes, though less handy in that case.
Instead of writing Array[ i ] try writing Array[vIndex]
The latter is a bit easier to spot and is also more robust against accidental deletions of letters.
Even better is naming the index for example
Array[vEntryIndex]
or
Array[vLetterIndex]
In case a typo/letter is accidently deleted for example:
Array[vLetterndex] or Array[vLetterInde]
It's still pretty clear what was there.
(In general it's better to avoid 1 letter variables, this will make the code much more robust).
CFTechno commented 2 days ago
Why not use i[name array] as the loop var name? like Array[iArray] that way in your code specially with nested loops you know exactly what variable is used for what array.
So your suggestion is to use:
MyArray[iMyArray].
I think it is pretty obvious why this is a bad idea. Readability suffers, it looks very much the same, and this is almost like playing "where's waldo". Where is the i ? Is there an i ? And it's still a one letter difference which is still not very robust.
MyArray[MyIndex] to keep the same style, is already much more clear, less error prone and more robust, thank you for the suggestion though.
There may also be other reasons like vIndex can also be re-used for other arrays in different loops. But this is of secondary concern.