Let’s talk about how we get to two different solutions for the game FizzBuzz.
The first solution uses a while loop to iterate through numbers 1 to 100. Using if/elsif control flow, we achieve the desired outcome of fizz for numbers divisible by 3, buzz for numbers divisible by 5, and fizzbuzz for numbers divisible by both 5 and 3.
The second solution employs the each method on range 1..100, storing the various instances of divisibility by 3 & 5 in two variables: m3 & m5. Next, the uses a case statement (as the condition of the iterator) to print out the values fizz, buzz, fizzbuzz, or i.