By Letter: Non-alphabet | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
  Email this page to a friend


For loop




<programming> A loop construct found in many imperative programming 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("Hello\n");

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.



< Previous TermsTerms Containing for loopNext Terms >
Foresight
for free
fork
fork bomb
forked
for
for loop
loop
Oberon
Q
FORM
FORMAC
FORMAL
formal argument
Formal Description Technique


Web Standards & Support:

Link to and support eLook.org Powered by LoadedWeb Web Hosting
Valid XHTML 1.0! Valid CSS! eLook.org FireFox Extensions