What is iteration

iteration

A B C D E F G H I J K L M O P Q R S T U V W X Y Z


EDV-Lexikon - previous definition IT - next definition Year 2000 problem


← Iteration →
(2009) Iteration is the term used to describe the repeated execution of a process. The number of executions (iterations) is either fixed beforehand or depends on whether a termination criterion has been met. An example of a fixed number of iterations is the FOR loop that is part of almost all programming languages. A criterion for terminating an iterative process with a previously unknown number of loop runs can be, for example, a sufficiently good approximation to a calculation result (example: search for a function's zero point). Occasionally both are combined and the iteration runs until either a certain result has been achieved or a predetermined number of loops has been processed. In contrast to recursion, an iterative function does not call itself.
The following table shows the calculation of the factorial of a natural number (greater than zero) once as an iteration and once as a recursion in an imaginary programming language:
iterationRecursion

Factorial = 1
FOR i = 1 to number:
Factorial = factorial * i
PRINT faculty

FUNCTION factor (number):
IF number = 1
THEN factor = 1
ELSE factorial = number * factorial (number-1)
PRINT factorial (number)




Additional requests? Email to Martin Vogel or comment on the blog!

Already been there? Imprint | Martin Vogel's homepage | Vogel's perspective - the blog | Forum Building and Environment