Inspectopedia
 
2024.3

Loop variable not updated inside loop

Warning
New
Last modified: 03 December 2024

Reports any variables and parameters that are used in a loop condition and are not updated inside the loop.

Such variables and parameters are usually used by mistake as they may cause an infinite loop if they are executed.

Example:

Configure the inspection:

Use the Ignore possible non-local changes option to disable this inspection if the condition can be updated indirectly (e.g. via the called method or concurrently from another thread).