No. Though output << i.to_s will produce the same result, his code is correct. And yours isn't if you do output << i
1. If not a multiple of 3 or 5 or 15, output = i.
2. If a multiple of 3, output << fizz.
3. If a multiple of 5, output << buzz
4. If a multiple of 15, "fizzbuzz". Already covered in 2 and 3 owing to <<
Apparently people mess up fizzbuzz even when they know it:)
No. Though output << i.to_s will produce the same result, his code is correct. And yours isn't if you do output << i
1. If not a multiple of 3 or 5 or 15, output = i.
2. If a multiple of 3, output << fizz.
3. If a multiple of 5, output << buzz
4. If a multiple of 15, "fizzbuzz". Already covered in 2 and 3 owing to <<
Apparently people mess up fizzbuzz even when they know it:)