Skip to content

Instantly share code, notes, and snippets.

@kpengboy
Last active November 8, 2021 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpengboy/4926e79dc6b6fe5ca6f6c3f094a7c48b to your computer and use it in GitHub Desktop.
Save kpengboy/4926e79dc6b6fe5ca6f6c3f094a7c48b to your computer and use it in GitHub Desktop.
99 bottles of beer, GN edition
# Copyright 2017 Google LLC.
# SPDX-License-Identifier: Apache-2.0
# Date: 28 Jul 2017
N = 99
print("$N bottles of beer on the wall, $N bottles of beer.")
i = N - 1
foreach(_, split_list([], N - 1)) {
if (i == 0) {
s_i = "no more"
} else {
s_i = "$i"
}
if (i == 1) {
bottles = "bottle"
} else {
bottles = "bottles"
}
print("Take one down and pass it around, $s_i $bottles of beer on the wall.")
print("")
print("$s_i $bottles of beer on the wall, $s_i $bottles of beer.")
i = i - 1
}
print("Take one down and pass it around, no more bottles of beer on the wall.")
print("")
print("No more bottles of beer on the wall, no more bottles of beer.")
print("Go to the store and buy some more, $N bottles of beer on the wall.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment