Previous: ’for-as-package’, Up: Iteration Control [Contents][Index]
repeat expr
The ‘repeat’ construct causes iteration to terminate after a specified number
of times. The loop body is executed n times, where n is the value of the
expression expr. The expr argument is evaluated one time in the loop
prologue. If the expression evaluates to zero or to a negative number, the
loop body is not evaluated.
The clause ‘repeat’ n is roughly equivalent to a clause such as
for internal-variable downfrom (- n 1) to 0
but, in some implementations, the ‘repeat’ construct might be more efficient.
(loop repeat 3 ;Prints 3 lines
do (format t "What I say three times is true~%"))
(loop repeat -15 ;Prints nothing
do (format t "What you see is what you expect~%"))