0%

for loop

F f

Transcription

    • US Pronunciation
    • US IPA
    • US Pronunciation
    • US IPA

Definitions of for loop words

  • noun Technical meaning of 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("Hello\n"); } prints "Hello" 10 times. Other languages provide a more succinct form of "for" statement specifically for iterating over arrays or lists. E.g., the Perl code, for my $task (@tasks) { postpone($task); } calls function "postpone()" repeatedly, setting $task to each element of the "@tasks" array in turn. This avoids introducing temporary index variables like "i" in the previous example. 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. 1
  • noun for loop (programming) A section of code in which an instruction or group of instructions is executed a specific number of times depending on the value of a loop counter. 0

Information block about the term

Parts of speech for For loop

noun
adjective
verb
adverb
pronoun
preposition
conjunction
determiner
exclamation

See also

Matching words

Was this page helpful?
Yes No
Thank you for your feedback! Tell your friends about this page
Tell us why?