Skip to content

Latest commit

 

History

History
15 lines (14 loc) · 412 Bytes

1530.md

File metadata and controls

15 lines (14 loc) · 412 Bytes
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.
	}
}