Skip to content

Instantly share code, notes, and snippets.

@timfernando
Created February 15, 2012 15:01
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 timfernando/1836400 to your computer and use it in GitHub Desktop.
Save timfernando/1836400 to your computer and use it in GitHub Desktop.
List comprehension fizzbuzz
fizzbuzz = (x) ->
if x%3 is 0 and x%5 is 0
"fizz bang"
else if x%3 is 0
"fizz"
else if x%5 is 0
"bang"
else ->
x
console.log (fizzbuzz i for i in [1..100])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment