From 72cf994869e19f6bdc4678e1122f0082d07d4a11 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 23 Sep 2017 18:31:26 -0700 Subject: 4002 --- factorial.mu | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'factorial.mu') diff --git a/factorial.mu b/factorial.mu index 8a261207..5b43d151 100644 --- a/factorial.mu +++ b/factorial.mu @@ -10,12 +10,8 @@ def main [ def factorial n:num -> result:num [ local-scope load-ingredients - { - # if n=0 return 1 - zero?:bool <- equal n, 0 - break-unless zero? - return 1 - } + # if n=0 return 1 + return-unless n, 1 # return n * factorial(n-1) x:num <- subtract n, 1 subresult:num <- factorial x -- cgit 1.4.1-2-gfad0