Module: FizzBuzzer::V11a

Defined in:
lib/fizzbuzzer.rb

Instance Method Summary collapse

Instance Method Details

#fizzbuzzObject



297
298
299
300
301
302
303
304
305
306
307
# File 'lib/fizzbuzzer.rb', line 297

def fizzbuzz
  result = []
  for n in 1..100 do
    result << if     n % 3 == 0 && n % 5 == 0 then "FizzBuzz"
              elsif  n % 3 == 0               then "Fizz"
              elsif  n % 5 == 0               then "Buzz"
              else   n
              end
  end
  result
end