3 ms·
say (1..100).map({ $_ %% (3|5) ?? ("Fizz" if $_ %% 3) ~ ("Buzz" if $_ %% 5) !! $_ }).join("\n") is my quick stab at a Perl 6 version. About the same length if
by colomon 14y ago
say (1..100).map({ $_ %% (3|5) ?? ("Fizz" if $_ %% 3) ~ ("Buzz" if $_ %% 5) !! $_ }).join("\n")
is my quick stab at a Perl 6 version. About the same length if I take out the spaces (which I'd rather not!).
- agentultra 14y agoPerl 6 is so cool! I like the bit $_ %% (3|5) A pretty nifty way to condense multiple values into a single test. I don't always perl, but when I do sometimes I like to golf because it's fun.