  Loop is a powerful program construct in classical computation, but its power
is still not exploited fully in quantum computation. The exploitation of such
power definitely requires a deep understanding of the mechanism of quantum loop
programs. In this paper, we introduce a general scheme of quantum loops and
describe its computational process. The notions of termination and almost
termination are proposed for quantum loops, and the function computed by a
quantum loop is defined. To show their expressive power, quantum loops are
applied in describing quantum walks. Necessary and sufficient conditions for
termination and almost termination of a general quantum loop on any mixed input
state are presented. A quantum loop is said to be (almost) terminating if it
(almost) terminates on any input state. We show that a quantum loop is almost
terminating if and only if it is uniformly almost terminating. It is observed
that a small disturbance either on the unitary transformation in the loop body
or on the measurement in the loop guard can make any quantum loop (almost)
terminating. Moreover, a representation of the function computed by a quantum
loop is given in terms of finite summations of matrices. To illustrate the
notions and results obtained in this paper, two simplest classes of quantum
loop programs, one qubit quantum loops, and two qubit quantum loops defined by
controlled gates, are carefully examined.
