Last active
November 8, 2021 04:16
-
-
Save kpengboy/4926e79dc6b6fe5ca6f6c3f094a7c48b to your computer and use it in GitHub Desktop.
99 bottles of beer, GN edition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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