RosettaCodeData/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer.ys
2023-07-09 17:42:30 -04:00

23 lines
472 B
Text

#!/usr/bin/env yamlscript
# Print the verses to "99 Bottles of Beer"
#
# usage:
# yamlscript 99-bottles.ys [<count>]
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"