Jump to content

Loops/For with a specified step: Difference between revisions

→‎{{header|Perl 6}}: Use a magic arithmetic series.
(adding MUMPS example)
(→‎{{header|Perl 6}}: Use a magic arithmetic series.)
Line 328:
 
=={{header|Perl 6}}==
{{works with|Rakudo|commit 24ebf398b8139e7dbb69786ced40d638d433ff9a2010.07}}
 
With at least two values on the left-hand side, the series operator (<code>...</code>) can infer an arithmetic series. (With at least three values, it can infer a geometric series, too.)
<lang perl6>for 2 ... * + 2, 8 {
 
<lang perl6>for 2, 4 ... * + 2, 8 {
print "$_, ";
}
 
say 'whom do we appreciate?';</lang><!-- "Whom" is infinitely more amusing. -->
 
845

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.