Fizz Buzz example in Ruby


SUBMITTED BY: Guest

DATE: May 21, 2015, 10:21 a.m.

FORMAT: Ruby

SIZE: 197 Bytes

HITS: 1050

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

comments powered by Disqus