user
Task

Write a program that prints the integers from   **1**   to   **100**   (inclusive).

But:

:   * for multiples of three,   print   **Fizz**     instead of the number;
    * for multiples of five,   print   **Buzz**     instead of the number;
    * for multiples of both three and five,   print   **FizzBuzz**     instead of the number.

The   *FizzBuzz*   problem was presented as the lowest level of comprehension required to illustrate adequacy.

Also see

* (a blog)   dont-overthink-fizzbuzz
* (a blog)   fizzbuzz-the-programmers-stairway-to-heaven
assistant
(formerly Perl 6)

**Works with**: Rakudo Star version 2015-09-10

Most straightforwardly:

```
for 1 .. 100 {
    when $_ %% (3 & 5) { say 'FizzBuzz'; }
    when $_ %% 3       { say 'Fizz'; }
    when $_ %% 5       { say 'Buzz'; }
    default            { .say; }
}
```

Or abusing multi subs:

```
multi sub fizzbuzz(Int $ where * %% 15) { 'FizzBuzz' }
multi sub fizzbuzz(Int $ where * %%  5) { 'Buzz' }
multi sub fizzbuzz(Int $ where * %%  3) { 'Fizz' }
multi sub fizzbuzz(Int $number        ) { $number }
(1 .. 100)».&fizzbuzz.say;
```

Or abusing list metaoperators:

```
[1..100].map({[~] ($_%%3, $_%%5) »||» "" Z&& <fizz buzz> or $_ })».say
```

Concisely (readable):

```
say 'Fizz' x $_ %% 3 ~ 'Buzz' x $_ %% 5 || $_ for 1 .. 100;
```

Shortest FizzBuzz to date:

```
say "Fizz"x$_%%3~"Buzz"x$_%%5||$_ for 1..100
```

And here's an implementation that never checks for divisibility:

```
.say for
    (
      (flat ('' xx 2, 'Fizz') xx *)
      Z~
      (flat ('' xx 4, 'Buzz') xx *)
    )
    Z||
    1 .. 100;
```