Skip to content

Instantly share code, notes, and snippets.

@kokudori
Created October 21, 2011 11:37
Show Gist options
  • Save kokudori/1303629 to your computer and use it in GitHub Desktop.
Save kokudori/1303629 to your computer and use it in GitHub Desktop.
CoffeeScriptでBuzzFib
fib = [1..10].map((x) -> do (x) -> if x is 0 or x is 1 then x else arguments.callee(x-1)+arguments.callee(x-2))
for n in [1..10]
console.log if n in fib and n % 5 is 0 then 'FibBuzz' else if n in fib then 'Fib' else if n % 5 is 0 then 'Buzz' else n
###
実行結果
Fib
Fib
Fib
4
FibBuzz
6
7
Fib
9
Buzz
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment