Next: Accumulation Clauses, Previous: For Clauses, Up: Loop Facility
Aside from for clauses, there are several other loop clauses
that control the way the loop operates. They might be used by
themselves, or in conjunction with one or more for clauses.
repeat integer (cl-loop repeat (1+ n) do ...)
(cl-loop for temp to n do ...)
are identical except that the second one forces you to choose
a name for a variable you aren't actually going to use.
while conditionnil. For example, the following two
loops are equivalent, except for the implicit nil block
that surrounds the second one:
(while cond forms...)
(cl-loop while cond do forms...)
until conditionnil.
always conditionnil.
Unlike while, it stops the loop using return nil so that
the finally clauses are not executed. If all the conditions
were non-nil, the loop returns t:
(if (cl-loop for size in size-list always (> size 10))
(some-big-sizes)
(no-big-sizes))
never conditionalways, except that the loop returns
t if any conditions were false, or nil otherwise.
thereis conditionnil;
in this case, it returns that non-nil value. If all the
values were nil, the loop returns nil.