aboutsummaryrefslogtreecommitdiff
path: root/tests/recurse.hgn
diff options
context:
space:
mode:
Diffstat (limited to 'tests/recurse.hgn')
-rw-r--r--tests/recurse.hgn11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/recurse.hgn b/tests/recurse.hgn
new file mode 100644
index 0000000..bf9a0fd
--- /dev/null
+++ b/tests/recurse.hgn
@@ -0,0 +1,11 @@
+main := proc() {
+ print_up_to(read_int(0))
+ exit(0)
+}
+
+print_up_to := proc(n) {
+ print(n)
+ if n > 0 {
+ print_up_to(n - 1)
+ }
+}