99 bottles Challenge thread 2

Started by
10 comments, last by Don Carnage 8 years, 8 months ago

Did anyone ever set up some sort of unofficial 'world's record' for this challenge in each language ?

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

Advertisement
Shortest I could manage in Powershell ph34r.png (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" 
}
It is I, the spectaculous Don Karnage! My bloodthirsty horde is on an intercept course with you. We will be shooting you and looting you in precisely... Ten minutes. Felicitations!

This topic is closed to new replies.

Advertisement