From: David Patterson <bob0the0mighty@cox.net>
Date: June 1, 2007 8:22:59 AM CDT
To: submission@rubyquiz.com
Subject: Please Forward: Ruby Quiz SubmissionI've been following Ruby Quiz for the last few months, but this is my
first submission.This is my hand written code:
(1..100).each {|x|
temp += (x%3==0) ? "Fizz" : ""
temp += (x%5==0) ? "Buzz" : ""
puts (temp.size==0) ? x : temp
}this didn't run because temp is Nil, which gets me sometimes.
Quick fix to:
(1..100).each {|x|
temp = (x%3==0) ? "Fizz" : ""
temp += (x%5==0) ? "Buzz" : ""
puts (temp.size==0) ? x : temp
}
and it ran fine. I wonder how bad this sort of error would be. Thanks
for the quizzes!David Patterson
···
Begin forwarded message: