Next: ’for-as-arithmetic’, Up: Iteration Control [Contents][Index]
In the following example, the variable x is stepped before y is stepped
(and is not used); thus, the value of y reflects the updated value of x:
(loop for x from 1 to 9
for y = nil then x
collect (list x y))
;;; => ((1 NIL) (2 2) (3 3) (4 4) (5 5) (6 6) (7 7) (8 8) (9 9))
In the following example, x and y are stepped in parallel (and is used):
(loop for x from 1 to 9
and y = nil then x
collect (list x y))
;;; => ((1 NIL) (2 1) (3 2) (4 3) (5 4) (6 5) (7 6) (8 7) (9 8))