Course of Raku / Essentials / Loops / Exercises

FizzBuzz in a loop

Problem

Modify the program from the earlier exercise ‘FizzBuzz’ to print the result for all integer numbers between 1 and 50. Each number appears on a separate line followed by Fizz and/or Buzz.

Example

The first few lines are shown:

$ raku fizbuzz-loop.raku
1: 
2: 
3: Fizz
4: 
5: Buzz
6: Fizz
7: 
8: 
. . .

Solution

See the solution

Next exercise

💪 Digital stairs

Course navigation

Conditional checks / Ternary operator   |   Data type conversion