Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 386 Bytes

suspicious_reverse_loop.md

File metadata and controls

17 lines (13 loc) · 386 Bytes

suspicious_reverse_loop

What it does

Checks for for _ = #x, 1 do sequences without specifying a negative step.

Why this is bad

This loop will only run at most once, instead of going in reverse. If you truly did mean to run your loop only once, just use if #x > 0 instead.

Example

for _ = #x, 1 do

...should be written as...

for _ = #x, 1, -1 do