Iteration

What Does Iteration Mean?

Iteration, in the context of computer programming, is a process wherein a set of instructions or structures are repeated in a sequence a specified number of times or until a condition is met. When the first set of instructions is executed again, it is called an iteration. When a sequence of instructions is executed in a repeated manner, it is called a loop.

Advertisements

Techopedia Explains Iteration

Iteration is the repetition of a process in a computer program, usually done with the help of loops.
An example of an iteration programming language is as follows:

Consider a database table containing 1000 student records. Each record contains the following fields:

  • First name
  • Last name
  • Roll no

If one wants to copy all the student records from the database and print them, the best way to retrieve the record is to iterate or loop through each record. It can be executed using the for loop statement as shown below:

for (int i=0;i<1000;i++)
{
Print first name and last name from table
}

In the above example, i is an iterator starting from the first student record to the last student record.

Advertisements

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…