Please Forward: Ruby Quiz Submission

From: Jared Haworth <jared.haworth@gmail.com>
Date: June 1, 2007 12:10:27 PM CDT
To: submission@rubyquiz.com
Subject: Please Forward: Ruby Quiz Submission

Since I'm not a member of the Ruby-Talk list:

1.upto(100) do |n|
    output = Array.new
    output << "Fizz" if (n % 3 == 0)
    output << "Buzz" if (n % 5 == 0)
    output << n if output.empty?
    puts output.to_s
end

I tried to strike the right balance between clever and readable. It's been my experience that people I'm working with would rather see the simple solution instead of the overly elegant 'Ruby' solution. Maybe that's the point of the test, not just for me to show off how awesome I can be, but to show if I can write code that others can understand? I can't wait to see what some of the others have come up with, though.

- Jared Haworth

···

Begin forwarded message: