Skip to content

Instantly share code, notes, and snippets.

@b3ll
Created September 23, 2014 15:29
Show Gist options
  • Save b3ll/f6d00c589c365b20b71e to your computer and use it in GitHub Desktop.
Save b3ll/f6d00c589c365b20b71e to your computer and use it in GitHub Desktop.
// 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