We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b85e5a commit ff6db14Copy full SHA for ff6db14
archive/o/ocaml/baklava.ml
@@ -0,0 +1,9 @@
1
+(** https://rosettacode.org/wiki/Repeat_a_string#OCaml **)
2
+let string_repeat n s =
3
+ String.concat "" (Array.to_list (Array.make n s));;
4
+
5
+for n = -10 to 10 do
6
+ let num_spaces = abs n in
7
+ let num_stars = 21 - 2 * num_spaces in
8
+ Printf.printf "%s%s\n" (string_repeat num_spaces " ") (string_repeat num_stars "*");
9
+done
0 commit comments