diff options
Diffstat (limited to 'factorial.mu')
-rw-r--r-- | factorial.mu | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/factorial.mu b/factorial.mu index 5b43d151..8a261207 100644 --- a/factorial.mu +++ b/factorial.mu @@ -10,8 +10,12 @@ def main [ def factorial n:num -> result:num [ local-scope load-ingredients - # if n=0 return 1 - return-unless n, 1 + { + # if n=0 return 1 + zero?:bool <- equal n, 0 + break-unless zero? + return 1 + } # return n * factorial(n-1) x:num <- subtract n, 1 subresult:num <- factorial x |