Inspectopedia
 
2024.3

Range can be converted to indices or iteration

Info
New
Last modified: 03 December 2024

Reports until and rangeTo operators that can be replaced with Collection.indices or iteration over collection inside for loop.

Using syntactic sugar makes your code simpler.

The quick-fix replaces the manual range with the corresponding construction.

Example:

After the quick-fix is applied: