Did anyone ever set up some sort of unofficial 'world's record' for this challenge in each language ?
99 bottles Challenge thread 2
Shortest I could manage in Powershell (251 chars):
function n($n, $c) {
$s = 's'
$( switch ($n) {
-1 { '99' }
0 { $c + 'o more' }
1 { $s = ''
"$n" }
default { "$n" }
}) + " bottle$($s) of beer"
}
$w = ' on the wall'
99..0 | % {
"$(n $_ 'N')$w, $(n $_ 'n')."
$( if ($_ -eq 0) {
'Go to the store and buy some more'
} else {
'Take one down and pass it around'
}) + ", $(n($_-1)'n')$w.`n"
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement