Back to Intellij Community

ForEachParameterNotUsed

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/ForEachParameterNotUsed.html

2025.3-rc-2221 B
Original Source

Reports forEach loops that do not use iterable values.

Example:

listOf(1, 2, 3).forEach { }

The quick fix introduces anonymous parameter in the forEach section:

listOf(1, 2, 3).forEach { _ -> }