A **loop variant** is a concept used in computer science, particularly in the context of program verification and formal methods. It is a condition that helps ensure that a loop terminates successfully and does not run indefinitely. A loop variant is typically a scalar value (it could be an integer or another comparable type) associated with a loop that satisfies two main properties: 1. **Initialization**: The loop variant must be initialized before the loop starts executing.
New to topics? Read the docs here!