Skip to content

Commit e8fdc08

Browse files
authored
Add Baklava in Spry (#4095)
1 parent 8e8cdd2 commit e8fdc08

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

archive/s/spry/baklava.sy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
abs = func [:x
2+
($x >= 0) then: [ $x ] else: [ 0 - $x ]
3+
]
4+
5+
repeat_string:times: = func [:s :n
6+
($n > 0) then: [ $s, repeat_string: $s times: ($n - 1) ] else: [ "" ]
7+
]
8+
9+
-10 to: 10 do: [
10+
num_spaces = abs :i
11+
num_stars = (21 - (num_spaces * 2))
12+
echo (repeat_string: " " times: num_spaces, repeat_string: "*" times: num_stars)
13+
]

0 commit comments

Comments
 (0)