Skip to content

Instantly share code, notes, and snippets.

@nilsnh
Last active December 13, 2015 20:58
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 nilsnh/4974250 to your computer and use it in GitHub Desktop.
Save nilsnh/4974250 to your computer and use it in GitHub Desktop.
Coffee-script fizzbuzz. Just had to try and make one after reading this: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
for i in [1..100]
if i % 3 is 0 and i % 5 is 0 then console.log "FizzBuzz"
else if i % 3 is 0 then console.log "Fizz"
else if i % 5 is 0 then console.log "Buzz"
else console.log "#{i}"
@snorremd
Copy link

La oss ta et rekursivt eksempel, because:

def fizzbuzz(n):
  if(n > 100): pass
  if i % 3 == 0 and i % 5 == 0: print "FizzBuzz"
  elif: i % 3 == 0: print "Fizz"
  elif: i % 5 == 0: print "Buzz"
  else: print i
  fizzbuzz(n+1)


fizzbuzz(1)

@nilsnh
Copy link
Author

nilsnh commented Feb 18, 2013

Aktiv Gist dette her. ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment