Created
October 21, 2011 11:37
-
-
Save kokudori/1303629 to your computer and use it in GitHub Desktop.
CoffeeScriptでBuzzFib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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