Loops/For with a specified step: Difference between revisions

Content added Content deleted
(jq)
Line 594: Line 594:
output += 'who do we appreciate?';
output += 'who do we appreciate?';
document.write(output);</lang>
document.write(output);</lang>

=={{header|jq}}==
To generate the stream (2,4,6,8):<lang jq># jq 1.4:
range(2;9) | select(. % 2 == 0)

# jq 1.4+:
range(2;9;2)</lang>
'''Example''':

reduce range(2;9;2) as $i
(""; . + "\($i), ") +
"whom do we appreciate?"</lang>


=={{header|Julia}}==
=={{header|Julia}}==