Other Definitions
iteration (dict)

Iteration

This article discusses a concept which is exploited in computer programming (but which originated before it). For use in the Japanese and Chinese languages see iteration mark.
Iteration is the repetition of a process, typically within a computer program. It can be used both as a general term, synonymous with repetition, and to describe a specific form of repetition with a mutable state. When used in the first sense, recursion is an example of iteration, but typically using a recursive notation, which is typically not the case for iteration. However, when used in the second (more restricted) sense, iteration describes the style of programming used in imperative programming languages. This contrasts with recursion, which has a more declarative approach.
   
Here is an example of iteration, in imperative pseudocode:
   var i, a := 0        // initialize a before iteration   for i from 1 to 3 {  // loop three times       a := a + i       // increment a by the current value of i   }   print a              // the number 6 is printed 
In this program fragment, the value of the variable i changes over time, taking the values 1, 2 and 3. This changing value—or mutable state—is characteristic of iteration. Iteration can be done in functional programming languages. The following example is in Scheme:
 (define (sum n) 	(define (iter i result) 
     (if (<= i n)         (+ i (iter (+ i 1) result))         result))     (iter 0 0)) 
An iterator is an object that wraps iteration.

See also

 

<< PreviousWord BrowserNext >>
colloquialism
kingdom of strathclyde
breakfast
24 (television)
battle of marston moor
surrealist women
lemelson mit prize
germaine greer
flemish brabant
schoolkids oz
zorah
zoheleth
ownership equity
zimri
ziklag
zerubbabel
zerah
moral politics
naturopathic medicine
zelophehad
zedekiah
zeboim (biblical)
list of irish people
zebah
zebadiah
norman conquest
manat
tampere
zareth shahar
actors' equity association
union
zaretan
amadeus i of savoy
windsor castle
zadok
zacharias
the state of the art
otto of savoy
dahlia
south africa
zacchaeus
limburg (belgium)
the player of games
luxembourg (province of belgium)