From TheBestLinks.com
Iteration is the repetition of a process, typically within a computer program. Confusingly, it can be used both as a general term, synonymous with repetition, and to describe a specific form of repetition with mutable state.
When used in the first sense, recursion is an example of 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:
The following is wikicode, a proposed pseudocode for Wikipedia articles.
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.
See also
de:Iteration
he:איטרציה
sv:Iteration
Related links
Top visited
0 of
0 links
[no links posted yet]
>> place link >>
Discussion
Last posted
0 of
0 messages
[no messages posted yet]
>> post message >>
Watch
You can
add this article to your own "watchlist" and receive e-mail notification about all changes in this page.