rule_id | rule_category | title | severity |
---|---|---|---|
1530 |
maintainability |
Don't change a loop variable inside a `for` loop |
2 |
Updating the loop variable within the loop body is generally considered confusing, even more so if the loop variable is modified in more than one place.
for (int index = 0; index < 10; ++index)
{
if (someCondition)
{
index = 11; // Wrong! Use 'break' or 'continue' instead.
}
}