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.

for statement

A high-level programming language structure that repeats a series of instructions a specified number of times. It creates a loop that includes its own control information. The following BASIC and C examples print "Hello" 10 times:

BASIC             C

 for x=1 to 10     for (x=0; x<10; x++)
  print "hello"     printf ("hello\n");
 next x
References in periodicals archive ?
Fitch has affirmed the following ratings for LOOP LLC:
Solomita says that these facilities will make it possible for all forms of waste PET and polyester fiber--even ocean plastics that have been degraded by the sun and saltwater-to be fully recovered and upcycled into PET "of the highest purity and performance quality." This integrated manufacturing design will be the basis for Loop's commercialization strategy.
Figure 4 presents TEM response of a large loop source over the three-layer earth model (as shown in the inset of the figure) for loop sizes of radii 100 m and 200 m, for central loop, in-loop, and offset-loop configurations.
The other reason for loop length, tightness, and loop shape factors of the two fabrics' variation is the yarn elongation property.
Malfunction rates for loop detectors can run as high as 14 percent, according to a Transportation Research Board paper, "Malfunction Detection and Data Repair for Induction-Loop Sensors Using 1-880 Data Base," by H.J.
Despite the theoretical limitations of Aligator, our experiments give practical evidence of the applicability of Aligator for loop reasoning and program verification.
The following is a selection of rests that should work quite nicely for loop shooters:
Whether the tuning capacitor is a rotary (air or vacuum variable) or made of individually switched components operation is much easier if adjusting the loop tuning capacitance for loop resonance is done automatically.
In our example the chord (defined as the edge that is not part of the tree) for Loop A has an elasticity of 35%, and there is one other edge in the loop that is then assigned this same elasticity [ILLUSTRATION FOR FIGURE 2 OMITTED].
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.
This startling scenario takes advantage of the fact that some solutions of the equations of general relativity provide handy shortcuts by twisting space-time in such a way that it contains "closed time-like curves" -- the technical term for looped paths that allow one to traverse relativistic space-time so that no time elapses between departure and return.