Loops/Continue: Difference between revisions
Content added Content deleted
(mark Scheme example broken) |
(added Ol) |
||
Line 1,673: | Line 1,673: | ||
"," . |
"," . |
||
] ;</lang> |
] ;</lang> |
||
=={{header|Ol}}== |
|||
We use continuation to break the execution of the inner body. |
|||
<lang scheme> |
|||
(let loop ((i 1)) |
|||
(when (less? i 11) |
|||
(call/cc (lambda (continue) |
|||
(display i) |
|||
(when (zero? (mod i 5)) |
|||
(print) |
|||
(continue #f)) |
|||
(display ", "))) |
|||
(loop (+ i 1)))) |
|||
</lang> |
|||
{{Out}} |
|||
<pre> |
|||
1, 2, 3, 4, 5 |
|||
6, 7, 8, 9, 10 |
|||
</pre> |
|||
=={{header|Oz}}== |
=={{header|Oz}}== |