Loops/While: Difference between revisions
→{{header|Perl 6}}: simplification
(added Applesoft BASIC implementation) |
(→{{header|Perl 6}}: simplification) |
||
Line 785:
=={{header|Perl 6}}==
Here is a straightforward translation of the task description:
The same thing with a C-style loop and a bitwise shift operator:
<lang perl6>loop (my $n = 1024; $n > 0; $n +>= 1) { say $n }</lang>
▲<lang perl6>say 1024 +> $_ for 0..10;</lang>
And here's how you'd <em>really</em> write it, using a sequence operator that intuits the division for you:
<lang perl6>.say for 1024, 512, 256 ... 1
=={{header|PHP}}==
|