Home
FOR loop end conditions should not be hard - coded
Rule description
- FOR loop end conditions should not be hard - coded
Non-compliant Code Example
function string TestFunctionCall (int cnt)
integer i
for i = 1 to 10 //Non compliant code (FOR loop end condition value is hard-coded)
boxes[i].Checked = NOT boxes[i].Checked
next
return "
end function
Compliant Code Example
function string TestFunctionCall (int cnt)
integer i
for i = 1 to cnt //Compliant code
boxes[i].Checked = NOT boxes[i].Checked
next
return "
end function