about summary refs log tree commit diff stats
path: root/factorial.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-10-04 21:26:42 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-10-04 21:29:45 -0700
commit984a6321ad3dd5a20797cbd8cba800081bf56ad4 (patch)
tree8e9dc8753b027bcd9530e620e147507a3dae6ced /factorial.mu
parentc0d61295ed3575cfea7d2a22d81bae93c6009308 (diff)
downloadmu-984a6321ad3dd5a20797cbd8cba800081bf56ad4.tar.gz
4009
Undo commit 4002 for factorial.mu, because index.html describes it as an
example showing the labels '{' and '}'.
Diffstat (limited to 'factorial.mu')
-rw-r--r--factorial.mu8
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