diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-03-08 17:07:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-08 17:07:01 +0100 |
| commit | 61aa7ebf79b2e7102be033f74bb1fafbfcdb3080 (patch) | |
| tree | 99459427dab6085a41b687fb0919d442215a8a31 /progs/tests/factorial.sy | |
| parent | 09c830296fdb55efbc7f590337ce72f5ec75c04b (diff) | |
| parent | 50d6472d56091d0fece3fb87837a3931215603e4 (diff) | |
| download | sylt-61aa7ebf79b2e7102be033f74bb1fafbfcdb3080.tar.gz | |
Merge pull request #99 from FredTheDino/indent-tests
Diffstat (limited to 'progs/tests/factorial.sy')
| -rw-r--r-- | progs/tests/factorial.sy | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/progs/tests/factorial.sy b/progs/tests/factorial.sy new file mode 100644 index 0000000..770bc33 --- /dev/null +++ b/progs/tests/factorial.sy @@ -0,0 +1,12 @@ +factorial :: fn n: int -> int { + if n <= 1 { + ret 1 + } + ret n * factorial(n - 1) +} + +start :: fn { + factorial(5) <=> 120 + factorial(6) <=> 720 + factorial(12) <=> 479001600 +} |
