summaryrefslogtreecommitdiffstats
path: root/t/recursion.t
diff options
context:
space:
mode:
Diffstat (limited to 't/recursion.t')
-rw-r--r--t/recursion.t9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/recursion.t b/t/recursion.t
index 5c3c29b..81a4cc4 100644
--- a/t/recursion.t
+++ b/t/recursion.t
@@ -24,4 +24,13 @@ is(fact(5), 120);
is(fun ($n = 8) { $n < 2 ? 1 : $n * __SUB__->($n - 1) }->(), 40320);
+fun fact2 ($n) {
+ if ($n < 2) {
+ return 1;
+ }
+ return $n * fact2($n - 1);
+}
+
+is(fact2(5), 120);
+
done_testing;