int i vs int index etc. Which one is better?
- by Earlz
Coming from a C background I've always used int i for generic loop variables. Of course in big nested loops or other complex things I may use a descriptive name but which one had you rather see?
int i;
for(i=0;i<Controls.Count;i++){
DoStuff(Controls[i]);
}
or
int index;
for(index=0;index<Controls.Count;index++){
DoStuff(Controls[index]);
}
In the current project I am working on there are both of these styles and index being replaced by ndx.
Which one is better? Is the i variable too generic? Also what about the other C style names? i, j, k Should all of these be replaced by actual descriptive variables?