Skip to content

Instantly share code, notes, and snippets.

@tisba
Forked from judofyr/fizzbuzz.rb
Created August 6, 2012 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tisba/3272201 to your computer and use it in GitHub Desktop.
Save tisba/3272201 to your computer and use it in GitHub Desktop.
Writing FizzBuzz with flip-flops
a=b=c=(1..100).each do |num|
print num, ?\r,
("Fizz" unless (a = !a) .. (a = !a)),
("Buzz" unless (b = !b) ... !((c = !c) .. (c = !c))),
?\n
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment