Skip to content

Commit

Permalink
Add Baklava in Pineapple (#4063)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuckerm authored Nov 20, 2024
1 parent 39adbc8 commit 3a72aa0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions archive/p/pineapple/baklava.pine
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def (this String).repeat(times Number) -> String
let i mutable = times
let s mutable = ""
while i > 0
s = "$(s)$(this)"
i = i - 1

return s

def .main
let i mutable = -10
while i <= 10
let numSpaces mutable = i
if numSpaces < 0
numSpaces = -numSpaces

let spaces = " ".repeat(numSpaces)
let stars = "*".repeat(21 - (2 * numSpaces))
"$(spaces)$(stars)".show
i = i + 1

0 comments on commit 3a72aa0

Please sign in to comment.