FOR quant IN 99..0
LET toPrint = (
quant > 1 ?
CONCAT(TO_STRING(quant), " bottles of beer on the wall, ", TO_STRING(quant), " bottles of beer.") :
(quant == 1 ?
"1 bottle of beer on the wall, 1 bottle of beer." :
"No more bottles of beer on the wall, no more bottles of beer."
)
)
LET suffix = (
quant > 2 ?
CONCAT(TO_STRING(quant - 1), " bottles of beer on the wall.") :
(quant == 2 ?
"1 bottle of beer on the wall." :
"no more bottles of beer on the wall."
)
)
LET result = (
quant > 0 ?
CONCAT(toPrint, "\nTake one down, pass it around, ", suffix) :
CONCAT(toPrint, "\nGo to the store and buy some more, 99 bottles of beer on the wall.")
)
RETURN result