Skip to content

Instantly share code, notes, and snippets.

@hyoshiok
Created October 31, 2011 02:58
Show Gist options
  • Save hyoshiok/1326806 to your computer and use it in GitHub Desktop.
Save hyoshiok/1326806 to your computer and use it in GitHub Desktop.
fizzbuzz in Ruby
#
# fizzbuzz
# author: hirotaka.yoshioka@mail.rakuten.com
# 10/31/2011
#
fz = ["fizzbuzz", 1, 2, "fizz", 4, "buzz", "fizz", 7, 8, "fizz",
"buzz", 11, "fizz", 13, 14]
(1..30).each {|i| p fz[i%15].class == String ? fz[i%15] : i}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment