Skip to main content

A for loop is a control structure used by many programming languages to iterate over a range. It is a way of repeating statements a number of times until the loop ends. Depending on the language this may be over a range of integers, iterators, etc.

A for loop is an entry control loop. Entry control means that before the execution enters the loop, the loop's condition is verified. If the condition is false the loop body will not execute.

The basic syntax is as follows:

for ( initialization of iteration variable ; condition ; increment/decrement )
{
     ...
}

For loop on Wikipedia

See also: , , , and .