99 bottles of beer on the wall
authorcassowarii <2374677+cassowarii@users.noreply.github.com>
Thu, 9 Jul 2026 21:02:14 +0000 (14:02 -0700)
committercassowarii <2374677+cassowarii@users.noreply.github.com>
Thu, 9 Jul 2026 21:02:14 +0000 (14:02 -0700)
sample/99bottlesofbeer.sa [new file with mode: 0644]

diff --git a/sample/99bottlesofbeer.sa b/sample/99bottlesofbeer.sa
new file mode 100644 (file)
index 0000000..58f1af8
--- /dev/null
@@ -0,0 +1,38 @@
+def bottles num, otw {
+  if num == 0 {
+    print `no more bottles of beer`
+  } else if num == 1 {
+    print num
+    print ` bottle of beer`
+  } else {
+    print num
+    print ` bottles of beer`
+  }
+
+  if otw {
+    print ` on the wall`
+  }
+
+  if num == 0 and otw {
+    print `!`
+  }
+
+  println ``
+}
+
+def verse num {
+  bottles num, true
+  bottles num, false
+  println `take one down, pass it around`
+  bottles num - 1, true
+
+  if num - 1 > 0 {
+    println ``
+  }
+}
+
+let counter = 99
+while counter > 0 {
+  verse counter
+  counter = counter - 1
+}