Loops/For with a specified step: Difference between revisions

Add Nu
(→‎Insitux: inclusion)
imported>Brie
(Add Nu)
Line 2,040:
{{out}}
<pre>3 6 9 12 15 18 21
</pre>
 
=={{header|Nu}}==
Here <code>each {}</code> is used to convert from a range to a list, so that it can be consumed by <code>every</code>
<syntaxhighlight lang="nu">
for i in (0..10 | each {} | every 2) {print $i}
</syntaxhighlight>
{{out}}
<pre>
0
2
4
6
8
10
</pre>
 
Anonymous user