Inspectopedia Help

Assignment to 'for' loop parameter

Reports assignments to for loop parameters inside the for loop body.

While occasionally intended, this construct can be extremely confusing, and is often the result of a typo.


for (value in [1, 2, 3]) { value = 4 // warning }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Groovy, 233.SNAPSHOT

Last modified: 13 July 2023