Created
September 23, 2014 15:29
-
-
Save b3ll/f6d00c589c365b20b71e to your computer and use it in GitHub Desktop.
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
// Fibonnaci Pandas | |
let terms = 10 | |
func fib(n:Int) -> Int { | |
if n == 0 || n == 1 { | |
return n | |
} else { | |
return fib(n-1) + fib(n-2) | |
} | |
} | |
func pandaString(n:Int) -> String { | |
var str = "" | |
for var i = 0; i < n; i++ { | |
str += "🐼" | |
} | |
return str | |
} | |
for i in 0...terms { | |
println("\(pandaString(fib(i)))\n") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment