Skip to content

Commit

Permalink
Add Baklava in Never (#4120)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuckerm authored Dec 24, 2024
1 parent 25cfa52 commit d3bcc2d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions archive/n/never/baklava.nev
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
func abs(n: int) -> int {
(n < 0) ? -n : n
}

func repeat_string(s: string, n: int) -> string {
var result = "";
var i = 0;
for (i = 0; i < n; i = i + 1) {
result = result + s
};

result
}

func main() -> int {
var i = 0;
for (i = -10; i <= 10; i = i + 1) {
var num_spaces = abs(i);
var num_stars = 21 - 2 * num_spaces;
prints(repeat_string(" ", num_spaces) + repeat_string("*", num_stars) + "\n")
};

0
}

0 comments on commit d3bcc2d

Please sign in to comment.