Skip to content

Instantly share code, notes, and snippets.

@ApolloZhu
Last active January 13, 2018 15:58
Show Gist options
  • Save ApolloZhu/e348ccce3edf1f455b603c4165c4802f to your computer and use it in GitHub Desktop.
Save ApolloZhu/e348ccce3edf1f455b603c4165c4802f to your computer and use it in GitHub Desktop.
let c={String(repeating:$0,count:$1)};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b}
print(d(5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment