How to resolve the algorithm 99 bottles of beer step by step in the YAMLScript programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm 99 bottles of beer step by step in the YAMLScript programming language
Table of Contents
Problem Statement
Display the complete lyrics for the song: 99 Bottles of Beer on the Wall.
The lyrics follow this form: ... and so on, until reaching 0 (zero). Grammatical support for 1 bottle of beer is optional. As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm 99 bottles of beer step by step in the YAMLScript programming language
Source code in the yamlscript programming language
#!/usr/bin/env yamlscript
# Print the verses to "99 Bottles of Beer"
#
# usage:
# yamlscript 99-bottles.ys []
defn main(number=99):
map(say):
map(paragraph):
(number .. 1)
defn paragraph(num): |
$(bottles num) of beer on the wall,
$(bottles num) of beer.
Take one down, pass it around.
$(bottles (num - 1)) of beer on the wall.
defn bottles(n):
???:
(n == 0) : "No more bottles"
(n == 1) : "1 bottle"
:else : "$n bottles"
You may also check:How to resolve the algorithm Sorting algorithms/Bogosort step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm RPG attributes generator step by step in the Racket programming language
You may also check:How to resolve the algorithm Bulls and cows/Player step by step in the Ring programming language
You may also check:How to resolve the algorithm Address of a variable step by step in the Panoramic programming language
You may also check:How to resolve the algorithm Smith numbers step by step in the PureBasic programming language