1530.md

February 3, 2022 ยท View on GitHub

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.
	}
}