We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cb80e3 commit 44e35aeCopy full SHA for 44e35ae
iteration.md
@@ -560,6 +560,29 @@ so it turns out we can specify the type before the `=` and chain the `with` with
560
collect (list x foo bar))
561
~~~
562
563
+We can also give `for` an `else` clause that will be called at each iteration:
564
+
565
+~~~lisp
566
+(loop for x in '(1 2 3)
567
+ for intermediate = 10 then (incf intermediate)
568
+ do (print intermediate))
569
+10
570
+11
571
+12
572
+~~~
573
574
+Here's a trick to alternate a boolean:
575
576
577
+(loop for x in '(1 2 3 4)
578
+ for up = t then (not up)
579
+ do (print up))
580
581
+T
582
+NIL
583
584
585
586
587
### Loop with a counter
588
#### loop
0 commit comments