for i = 0; i < 10; i++:
...
for i = 0; i < 10; i++:
...
The solution is to rename the variable in one of the loops, but it would be nice if the compiler warned about this.
I'm not sure how I should detect loops like this. Maybe just detect any two nested for loops that start with for foo = bar; ..., where foo parts are the same variable? I don't want to make it too general. For example, this should not trigger the warning:
for i = 0; i < 10; i++:
...
for i = 0; i < 10; i++:
...
I have multiple times written Jou code like this:
The solution is to rename the variable in one of the loops, but it would be nice if the compiler warned about this.
I'm not sure how I should detect loops like this. Maybe just detect any two nested for loops that start with
for foo = bar; ...
, wherefoo
parts are the same variable? I don't want to make it too general. For example, this should not trigger the warning: