In computer science a for-loop or for loop is a control flow statement for specifying iteration. Specifically, a for loop functions by running a section of code repeatedly until a certain condition has been satisfied.
For-loops have two parts: a header and a body. The header defines the iteration and the body is the code that is executed once per iteration. The header often declares an explicit loop counter or loop variable. This allows the body to know which iteration is being executed. For-loops are typically used when the number of iterations is known before entering the loop. For-loops can be thought of as shorthands for while-loops which increment and test a loop variable.
Various keywords are used to indicate the usage of a for loop: descendants of ALGOL use "for", while descendants of Fortran use "do". There are other possibilities, for example COBOL which uses PERFORM VARYING.
The name for-loop comes from the word for. For is used as the reserved word (or keyword) in many programming languages to introduce a for-loop. The term in English dates to ALGOL 58 and was popularized in ALGOL 60. It is the direct translation of the earlier German für and was used in Superplan (1949–1951) by Heinz Rutishauser. Rutishauser was involved in defining ALGOL 58 and ALGOL 60.[1] The loop body is executed "for" the given values of the loop variable. This is more explicit in ALGOL versions of the for statement where a list of possible values and increments can be specified.
In Fortran and PL/I, the keyword DO is used for the same thing and it is named a do-loop; this is different from a do-while loop.
^Wirth, Niklaus (1973). "Preface". Systematic Programming: An Introduction. pp. xiii. ISBN 0138803692.
In computer science a for-loop or forloop is a control flow statement for specifying iteration. Specifically, a forloop functions by running a section...
up loop in Wiktionary, the free dictionary. Loop or LOOP may refer to: Loop (mobile), a Bulgarian virtual network operator and co-founder of Loop Live...
Look up the Loop in Wiktionary, the free dictionary. The Loop may refer to: The Loop, a 1992 novel by Joe Coomer The Loop, a 1998 novel by Nicholas Evans...
In the Loop is a 2009 British satirical black comedy film directed by Armando Iannucci. It is a spin-off from Iannucci's BBC Television series The Thick...
"Loop de Loop" is a song written by Teddy Vann and Joe Dong and performed by Johnny Thunder featuring The Bobbettes. It reached No. 4 on the U.S. pop chart...
loop in Wiktionary, the free dictionary. Looping may refer to: Loop (music), a repeating section of sound material Audio induction loop, an aid for the...
In computer programming, an infinite loop (or endless loop) is a sequence of instructions that, as written, will continue endlessly, unless an external...
An inoculation loop (also called a smear loop, inoculation wand or microstreaker) is a simple tool used mainly by microbiologists to pick up and transfer...
The OODA loop (observe, orient, decide, act) is a decision-making model developed by military strategist and United States Air Force Colonel John Boyd...
Closed loop or closed-loop may refer to: Loop (topology) Closed curve A closed feedback loop: Closed-loop transfer function Electronic feedback loop PID...
The Loop, one of Chicago's 77 designated community areas, is the central business district of the city and is the main section of Downtown Chicago. Home...
control system theory, loop gain is the sum of the gain, expressed as a ratio or in decibels, around a feedback loop. Feedback loops are widely used in electronics...
butterflies Looper (surname), a Dutch-language surname with the meaning "runner" Looper, a (usually electronic) tool for creating music loopsLooper, a person...
The generic roller coaster vertical loop, also known as a Loop-the-loop, or a Loop-de-loop, where a section of track causes the riders to complete a 360...
The Great Loop is a system of waterways that encompasses the eastern portion of the United States and part of Canada. It is made up of both natural and...
In the kidney, the loop of Henle (English: /ˈhɛnli/) (or Henle's loop, Henle loop, nephron loop or its Latin counterpart ansa nephroni) is the portion...
Loop unrolling, also known as loop unwinding, is a loop transformation technique that attempts to optimize a program's execution speed at the expense...
A Strange Loop is a musical with book, music, and lyrics by Michael R. Jackson, and winner of the 2020 Pulitzer Prize for Drama. First produced off-Broadway...
A strange loop is a cyclic structure that goes through several levels in a hierarchical system. It arises when, by moving only upwards or downwards through...
The time loop or temporal loop is a plot device in fiction whereby characters re-experience a span of time which is repeated, sometimes more than once...
foreach loop (or for-each loop) is a control flow statement for traversing items in a collection. foreach is usually used in place of a standard forloop statement...
A switching loop or bridge loop occurs in computer networks when there is more than one layer 2 path between two endpoints (e.g. multiple connections...
A loop antenna is a radio antenna consisting of a loop or coil of wire, tubing, or other electrical conductor, that for transmitting is usually fed by...
compulsion loop or core loop is a habitual chain of activities that will be repeated by the user to cause them to continue the activity. Typically, this loop is...
A sentinel loop is a sign seen on a radiograph that indicates localized ileus from nearby inflammation. Simply put, it is the dilation of a segment of...