In mathematics, the term "loop" may refer to any of the following:
- A knot or hitch that holds its form.
- A degenerate edge of a graph that joins
a vertex to itself.
- A sequence of instructions that is repeated either a specified number
of times or until a particular condition prevails. Loops lie at the
heart of most computer programs. The most common type is the iterative
loop, signified by keywords such as for, while, do, and repeat, or their equivalent, in which a given
set of instructions is repeated a specified number of times. The recursive
loop is a more powerful construct that carries out a given
set of instructions, typically including recursive calls with modified parameters back to the instruction set itself, until
a terminating condition is met. Recursive algorithms solve problems
by reducing them to smaller and smaller subproblems until a solution
is found, reusing the same set of instructions as often as needed.