Don't miss an insight. Subscribe to Techopedia for free.


Loop Variable

What Does Loop Variable Mean?

In computer programming, a loop variable is a variable that is set in order to execute some iterations of a "for" loop or other live structure.


A loop variable is a classical fixture in programming that helps computers to handle repeated instructions.

Techopedia Explains Loop Variable

Here's how this works — the loop variable is set at a particular integer. Then it's set to increase by one during the length of the loop. When the integer reached reaches the number of desired repeats, the programmer directs the "for" loop to terminate.

So if you have "x equals one" and a "for" loop that operates until x equals five, given an increase of one in each loop iteration, you'll have the operation run five times. That is, depending on where the execution step is in relation to the variable increase.

Traditional programmers are well familiar with loop variables. It's a very simple tool in what has become an incredibly complex world of mathematics and programming syntax.


Related Terms