J
Jason Cavett
This was a discussion my co-worker and I had awhile back and I was
curious what the group thought.
for(int i=0; i < someValue; i++) {
// do stuff
}
The discussion was that the use of the variable "i" was not good as it
should be named something that means something (arrayCounter or
whatever) so it is easier to understand the code. The reverse
argument was that using the "i" variable as a counter was an okay
practice and it is alright as long as it is the only variable doing
this (all other variables are well named). Convenience of typing "i"
versus "someLongVariableName" was the argument on this side.
I'm just curious what everybody here thinks about this. Are there any
standards on this topic?
P.S. I purposely didn't state what my position was.
P.P.S. Both parties agreed that meaningful variables were a good thing
overall.
curious what the group thought.
for(int i=0; i < someValue; i++) {
// do stuff
}
The discussion was that the use of the variable "i" was not good as it
should be named something that means something (arrayCounter or
whatever) so it is easier to understand the code. The reverse
argument was that using the "i" variable as a counter was an okay
practice and it is alright as long as it is the only variable doing
this (all other variables are well named). Convenience of typing "i"
versus "someLongVariableName" was the argument on this side.
I'm just curious what everybody here thinks about this. Are there any
standards on this topic?
P.S. I purposely didn't state what my position was.
P.P.S. Both parties agreed that meaningful variables were a good thing
overall.