Skip to content

Commit 3d677cc

Browse files
authored
Add Baklava in Moonscript (#4143)
1 parent 3de10e8 commit 3d677cc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

archive/m/moonscript/baklava.moon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
string_repeat = (s, n) ->
2+
result = ""
3+
for i = 1, n
4+
result ..= s
5+
return result
6+
7+
for i = -10, 10
8+
num_spaces = math.abs i
9+
num_stars = 21 - 2 * num_spaces
10+
print string_repeat(" ", num_spaces) .. string_repeat("*", num_stars)

0 commit comments

Comments
 (0)