Skip to content

Instantly share code, notes, and snippets.

@tocky
Created March 14, 2012 02:18
Show Gist options
  • Save tocky/2033458 to your computer and use it in GitHub Desktop.
Save tocky/2033458 to your computer and use it in GitHub Desktop.
FizzBuzz One-Liner by CoffeeScript (without "if-else" statement)
fizzbuzz = (x) -> console.log (i % 3 is 0 and i % 5 is 0 and "fizzbuzz" or i % 3 is 0 and "fizz" or i % 5 is 0 and "buzz" or i) for i in [1..x]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment