4 ms·
If you count to 100 or iterate over some array, i, j, k, l are more readable than index1, index2, index3, index4 simply because they are shorter and still mean
by mich41 14y ago
If you count to 100 or iterate over some array, i, j, k, l are more readable than index1, index2,
index3, index4 simply because they are shorter and still mean the same.
And if you iterate over some collections of "meaningful" objects, meaningful names are more readable than either i or index.
It never makes sense to use index over i.
- gnaritas 14y agoIf there were nested loops, I'd use meaningful names, and as a matter of course of using meaningful names, index beats i on a single loop. It's silly to sometimes use meaningful names and sometimes abbreviate because you're too lazy to type. Of course, these are personal subjective things, but if you allow the habit of abbreviation, it tends to spread where it isn't appropriate, better to simply not do it.
- Dylan16807 14y ago'index' just isn't meaningful. Use actual meaning or use shorthand. Don't waste verbosity.
- klibertp 14y agoOf course, it should be `aStreamPosition` rather than `index` - still not `i` ;)
- gnaritas 14y ago"index" is very meaningful, it tells me I'm indexing and not counting, otherwise I'd use "count". Confusion between those two often causes off by one errors, so yes it does actually matter and is actually meaningful. You might like "i" or "n" to convey the same meaning, but as I said, I want words not abbreviations.