Loop variables track the state of your iteration. Counters like i track the current position. Accumulators like sum store running totals that grow with each pass. You initialize loop variables before the loop starts: int sum = 0; int i = 1;.
You update them inside the loop body: sum += i; i++; to make progress. Loop variables can be reused after the loop exits. Their final values reflect the last iteration. If i exits when it reaches 10, i still equals 10 after the loop.