You are viewing a single comment's thread from:

RE: Introducing the Coding Challenge

in #coding-challenge7 years ago (edited)

My ruby solution to FizzBuzz: https://repl.it/KNug/2

I used the range iterator (0..100).each because it is really nice to read in my opinion.

Constants are important, but FIZZBUZZ depends on FIZZ and BUZZ so a dynamic constant is best there.

helper functions to test for the various cases are really helpful for testing at. And the final fizzbuzz function reads like natural language.

The code works for negative values just fine and all functions are pure, so it can be used without printing anything.