Loops/For with a specified step: Difference between revisions
Content added Content deleted
m (→{{header|J}}) |
m (→{{header|Wren}}: Wren-trait -> Wren-iterate) |
||
Line 2,840: | Line 2,840: | ||
</pre> |
</pre> |
||
<br> |
<br> |
||
{{libheader|Wren- |
{{libheader|Wren-iterate}} |
||
A further and more general approach is to use a wrapper class (such as the one in the above module) which can iterate over any sequence in a stepped fashion using Wren's ''iterator protocol''. |
A further and more general approach is to use a wrapper class (such as the one in the above module) which can iterate over any sequence in a stepped fashion using Wren's ''iterator protocol''. |
||
<syntaxhighlight lang="ecmascript">import "/ |
<syntaxhighlight lang="ecmascript">import "/iterate" for Stepped |
||
// Print odd numbers under 20. |
// Print odd numbers under 20. |