for loop


Also found in: Wikipedia.

for loop

(programming)
A loop construct found in many procedural languages which repeatedly executes some instructions while a condition is true.

In C, the for loop is written in the form;

for (INITIALISATION; CONDITION; AFTER) STATEMENT;

where INITIALISATION is an expression that is evaluated once before the loop, CONDITION is evaluated before each iteration and the loop exits if it is false, AFTER is evaluated after each iteration, and STATEMENT is any statement including a compound statement within braces ".." that is executed if CONDITION is true.

For example:

int i; for (i = 0; i < 10; i++) printf

prints "Hello" 10 times.

The for loop is an alternative way of writing a while loop that is convenient because the loop control logic is collected in a single place. It is also closely related to the repeat loop.
References in periodicals archive ?
It took considerable mathematical ingenuity on the part of Rovelli, Kirill Krasnov of Penn State, and others to overcome the problem and finally develop an expression compatible with the Bekenstein-Hawking formula for black hole entropy Those calculations represent a significant success for loop quantum gravity, Rovelli says.
SELT and DELT are emerging as the standards for loop qualification and diagnostics, aiding in the elimination of costly external test equipment.
This new market for loop management systems has been created by service providers faced with multitudes of subscribers clamoring for inexpensive, guaranteed DSL service.
2Wire's loop extender technology integrates an advanced load coil design into the loop extender hardware, enabling us to maintain standard telephone service, which is critical for loops longer than 18,000 feet," said Tower.