Reuse of iterator variables cc4m_logo_inline

IDFCNS-13
TitleDo not reuse iterator variables within a function.
PriorityStrongly recommended
Severity level5
DescriptionDo not reuse iterator variables within the same function. Limit the scope of an iterator variable to its for loop.
RationalePrevents renaming all iterators when only the one for a specific loop must be renamed. Also improves readability.

Avoid:

for iNode = 1 : numel(nodes)
    ...
end

for iNode = 1 : 2 : 11
    ...
end

Instead use:

for iNode = 1 : numel(nodes)
    ...
end

for iValue = 1 : 2 : 11
    ...
end