From 2ef3fa41eeb57880e83f3fbbe8c2481d205bec40 Mon Sep 17 00:00:00 2001 From: cassowarii <2374677+cassowarii@users.noreply.github.com> Date: Thu, 9 Jul 2026 14:02:14 -0700 Subject: [PATCH] 99 bottles of beer on the wall --- sample/99bottlesofbeer.sa | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sample/99bottlesofbeer.sa diff --git a/sample/99bottlesofbeer.sa b/sample/99bottlesofbeer.sa new file mode 100644 index 0000000..58f1af8 --- /dev/null +++ b/sample/99bottlesofbeer.sa @@ -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 +} -- 1.8.3.1