From d5feadd70b4f9b9da6003fe7100ade50ea7394e5 Mon Sep 17 00:00:00 2001 From: Natapat Samutpong Date: Sat, 19 Mar 2022 10:03:43 +0700 Subject: [PATCH] Create factorial.hz --- example/factorial.hz | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 example/factorial.hz diff --git a/example/factorial.hz b/example/factorial.hz new file mode 100644 index 0000000..e8f98e5 --- /dev/null +++ b/example/factorial.hz @@ -0,0 +1,10 @@ +fun factorial (n: int): int = do + case n of + | 0 -> return 1; + \ return n * factorial(n - 1); + end; +end; + +fun main: void = do + factorial(5) |> @write(_); +end; \ No newline at end of file