---
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
---
SIM113 Use `enumerate()` for index variable `idx` in `for` loop
 --> SIM113.py:6:9
  |
4 |     for x in range(5):
5 |         g(x, idx)
6 |         idx += 1
  |         ^^^^^^^^
7 |         h(x)
  |

SIM113 Use `enumerate()` for index variable `idx` in `for` loop
  --> SIM113.py:17:9
   |
15 |         if g(x):
16 |             break
17 |         idx += 1
   |         ^^^^^^^^
18 |         sum += h(x, idx)
   |

SIM113 Use `enumerate()` for index variable `idx` in `for` loop
  --> SIM113.py:27:9
   |
25 |         g(x)
26 |         h(x, y)
27 |         idx += 1
   |         ^^^^^^^^
   |

SIM113 Use `enumerate()` for index variable `idx` in `for` loop
  --> SIM113.py:36:9
   |
34 |     for x in range(5):
35 |         sum += h(x, idx)
36 |         idx += 1
   |         ^^^^^^^^
   |

SIM113 Use `enumerate()` for index variable `idx` in `for` loop
  --> SIM113.py:44:9
   |
42 |     for x in range(5):
43 |         g(x, idx)
44 |         idx += 1
   |         ^^^^^^^^
45 |         h(x)
   |

SIM113 Use `enumerate()` for index variable `i` in `for` loop
   --> SIM113.py:204:9
    |
202 |     for val in [1, 2, 3]:
203 |         print(f"{i}: {val}")
204 |         i += 1
    |         ^^^^^^
205 |
206 |     i = 0
    |

SIM113 Use `enumerate()` for index variable `i` in `for` loop
   --> SIM113.py:209:9
    |
207 |     for val in [1, 2, 3]:
208 |         print(f"{i}: {val}")
209 |         i += 1
    |         ^^^^^^
    |

SIM113 Use `enumerate()` for index variable `i` in `for` loop
   --> SIM113.py:220:9
    |
218 |     for val in [1, 2, 3]:
219 |         print(f"{i}: {val}")
220 |         i += 1
    |         ^^^^^^
    |
