Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Created August 9, 2012 06:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuroyoro/3301740 to your computer and use it in GitHub Desktop.
Save yuroyoro/3301740 to your computer and use it in GitHub Desktop.
Array#cycleでfizzbuzz
([Array.new(2, "").push("Fizz").cycle, Array.new(4, "").push("Buzz").cycle]).tap{|fizz, buzz| (1..100).map{|n| [fizz.next + buzz.next, n.to_s].sort.last}.each(&method(:puts))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment