Loops/For with a specified step: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: more 'series' --> 'sequence', sorry 'bout the noise)
(Add Clojure)
Line 111: Line 111:
}
}
}</lang>
}</lang>

=={{header|Clojure}}==
The first example here is following the literal specification, but is not idiomatic Clojure code. The second example achieves the same effect without explicit looping, and would (I think) be viewed as better code by the Clojure community.
<lang Clojure>(loop [i 0]
(println i)
(when (< i 10)
(recur (+ 2 i))))

(doseq [i (range 0 12 2)]
(println i))</lang>


=={{header|Common Lisp}}==
=={{header|Common Lisp}}==