Loop (computing)
From Wiki @ Karl Jones dot com
Revision as of 12:45, 6 February 2016 by Karl Jones (Talk | contribs)
In computing, a loop is a sequence of statements which is specified once but which may be carried out several times in succession.
Description
The code "inside" the loop (the body of the loop, shown below as xxx) is obeyed a specified number of times, or once for each of a collection of items, or until some condition is met, or indefinitely.
In functional programming languages, such as Haskell and Scheme, loops can be expressed by using recursion or fixed point iteration rather than explicit looping constructs. Tail recursion is a special case of recursion which can be easily transformed to iteration.
Examples
Various types of loop exist:
- Count-controlled loops
- Condition-controlled loops
- Collection-controlled loops
- General iteration
- Infinite loops
- Continuation with next iteration
- Redo current iteration
- Restart loop
- Early exit from loops
- Loop variants and invariants
See also
External links
- Control flow: Loops @ Wikipedia