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

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…