Fizz Buzz in Ruby


SUBMITTED BY: Guest

DATE: May 21, 2015, 9:51 a.m.

FORMAT: Ruby

SIZE: 191 Bytes

HITS: 810

  1. # fizz buzz ruby example
  2. p begin
  3. 1.upto(100){|i|i%3<1&&s=:Fizz;p i%5<1?"#{s}Buzz":s||i}
  4. rescue Exception
  5. puts "#{$!} (#{$!.class})"
  6. $stdout.flush
  7. raise $!
  8. end

comments powered by Disqus