Created
October 21, 2011 11:20
-
-
Save kokudori/1303589 to your computer and use it in GitHub Desktop.
CoffeeScriptでFibBuzz
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
for fib in [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)) | |
console.log do -> if fib % 15 is 0 then 'FizzBuzz' else if fib % 3 is 0 then 'Fizz' else if fib % 5 is 0 then 'Buzz' else fib | |
### | |
実行結果 | |
1 | |
1 | |
2 | |
Fizz | |
Buzz | |
8 | |
13 | |
Fizz | |
34 | |
Buzz | |
### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment