Loops/Continue: Difference between revisions

Content added Content deleted
(Omitted EasyLang)
Line 2,155: Line 2,155:


=={{header|Scheme}}==
=={{header|Scheme}}==
For R7RS Scheme. In this functional solution, there is no "continue". Instead, the "loop" function is directly called in the tail ([[Category:Recursion|tail recusrion]]).
{{incorrect|Scheme|}}
{{incorrect|Scheme|}}
<syntaxhighlight lang="scheme">(define (loop i)
<syntaxhighlight lang="scheme">(import (scheme base)
(scheme write))
(if (> i 10) 'done

(begin
(define (loop-fn start end)
(display i)
(cond ((zero? (modulo i 5))
(define (loop i)
(newline) (loop (+ 1 i)))
(if (> i end) #f
(else (display ", ")
(begin
(loop (+ 1 i)))))))</syntaxhighlight>
(display i)
(cond ((zero? (modulo i 5))
(newline) (loop (+ 1 i)))
(else
(display ", ")
(loop (+ 1 i)))))))
(loop start))

(loop-fn 1 10)</syntaxhighlight>


=={{header|Scilab}}==
=={{header|Scilab}}==