[DFW.pm] Homework for the list, and for Oct 08 meeting

Robert Flach robert.flach at webtooldeveloper.com
Thu Sep 11 13:50:20 PDT 2014


So Patrick,

  If I want to see your solution running, what's the best recommended 
way to get a working perl6 environment these days?

Robert Flach
*Web Tools*
On 9/11/2014 1:32 PM, Patrick R. Michaud wrote:
> Perl 6 solution #1, the straightforward one:
>
>      for 1..100 {
>          when $_ %% (3 & 5) { say "FizzBuzz" }
>          when $_ %% 5       { say "Buzz" }
>          when $_ %% 3       { say "Fizz" }
>          say $_;
>      }
>
>
> Some explanation:
>
>    - The Perl 6 "%%" operator returns true if the left argument is evenly
>      divisible by the right argument.
>
>    - The "when" keyword is Perl 6's version of a "switch/case" statement;
>      when the test is true, the block following it is executed and control
>      skips to the end of the enclosing block.
>
>    - The expression "$_ %% (3 & 5)" is true if $_ is evenly divisible
>      by both 3 and 5.  (The "&" operator in Perl 6 creates a junction
>      of values, the numeric bitwise-and operator in Perl 6 is "+&".)
>
> Pm
> _______________________________________________
> Dfw-pm mailing list
> Dfw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/dfw-pm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20140911/dda2993f/attachment-0001.html>


More information about the Dfw-pm mailing list