g | x | w | all
Bytes Lang Time Link
298Tcl170625T113105Zsergiol
nanDeadfish~210429T113708Zemanresu
297Charcoal170625T221209ZCharlie
312shortC170513T220227ZMD XF
261Ruby170519T203723ZAlex
232Javascript ES6170513T201509Znderscor
309JavaScript ES6170513T051758ZArjun
274C GCC170513T001050ZQuentin
339Java170514T131519Zh.j.k.
242PHP170513T011219ZJör
344C170513T214627ZMD XF
131SOGL170512T214547Zdzaima
456sed170513T111750Zeush77
230Retina170512T203357ZNeil
245Python 2170512T195533ZRod
14305AB1E170512T205037ZEmigna
273Röda170512T200418Zuser4180

Tcl, 298 bytes

proc B i {set x " bottle[expr $i>1?"s":""] of [expr $i%3?$i%5?"beer":"":"fizz"][expr $i%5?"":"buzz"]"}
set i 99
time {puts "$i[B $i][set w " on the wall"], $i[B $i].
Take one down and pass it around, [incr i -1][B $i]$w."} 98
puts "1[B $i]$w, 1[B $i].
Go to the store and buy some more, 99[B 9]$w."

Try it online!

Deadfish~, 88919 bytes

Try it online

Code is too long for answer.

Charcoal, 307 297 bytes

A”|‽2?{:×G↗”¦αA“6«eMηOU¶¿”¦ζA“9“e▷·gqε-g}”¦βA“9B{⦃⁺Bφ=;λO”¦ωAfizz¦φAbuzz¦γAbeer¦ηA”↶C▶▶d℅d¬r·US\λTθNevT◧→GM⁸ω┦τA“M↧k↓⁺*f÷,ψZ¢▶\¿|P“№κ×υpξXoW”¦σA.¶πF⮌…¹¦¹⁰⁰«A⎇⁻ι¹αζθ¿∧¬﹪鳬﹪ι⁵A⁺φγ﹪ι³Aφ﹪ι⁵AγεAηε⁺⁺⁺⁺⁺⁺⁺IιθεβIιθεπ¿⁻ι¹A⁻ι¹λA⁹⁹λA⎇⁻λ¹αζθ¿∧¬﹪볬﹪λ⁵A⁺φγ﹪λ³Aφ﹪λ⁵AγεAηε¿⁻ι¹AτδAσδ⁺⁺⁺⁺δλθεω

Try it online!

YES, WE CAN! Link to the verbose version, this can be golfed a lot, I'm sure.

shortC, 314 312 bytes

Db(x)x^1?" bottles":" bottle"
Dg i-1?"Take one down and pass it around":"Go to the store and buy some more"
*w=" on the wall";*s(x){Tx?x%15?x%5?x%3?"beer":"fizz":"buzz":"fizzbuzz":"fizz";}i=100;AW--i){R"%d%s of %s%s, %d%s of %s.\n%s, %d%s of %s%s.\n",i,b(i),s(i),w,i,b(i),s(i),g,i-1?i-1:99,b(i-1),s(i-1),w

Sorry there's no explanation, but I completely forgot how this works.

Ruby, 261 bytes

99.downto(1){|i|w=' on the wall'
f=->x{a='';x%3<1&&a+='fizz';x%5<1&&a+='buzz';a<?a&&a='beer';"%d bottle%s of %s"%[x,x<2?'':?s,a]}
puts [f[i]+w,f[i]+?.+$/+(i<2?'Take one down and pass it around':'Go to the store and buy some more'),f[i<2?99:i-1]+w+?.+$/*2]*', '}

Try it online!

Javascript (ES6), 236 234 233 232 bytes

for(i=99;i;console.log(z()+`, ${z(_)}.
${--i?'Take one down and pass it around':'Go to the store and buy some more'}, ${z()}.

`))z=(o=' on the wall',j=i||99)=>j+` bottle${j>1?'s':_} of `+((j%3?_:'fizz')+(j%5?_='':'buzz')||'beer')+o

Demo

// replace console.log to avoid 50-log limit in snippets:
console.log=_=>document.write(`<pre>${_}</pre>`)

for(i=99;i;console.log(z()+`, ${z(_)}.
${--i?'Take one down and pass it around':'Go to the store and buy some more'}, ${z()}.

`))z=(o=' on the wall',j=i||99)=>j+` bottle${j>1?'s':_} of `+((j%3?_:'fizz')+(j%5?_='':'buzz')||'beer')+o

Ungolfed

i = 99  // start counter at 99

z = (   // define function z which takes arguments with defaults:
   o = ' on the wall', // o = defaults to ' on the wall'
   j = i || 99         // j = defaults to value of counter i - or 99 when i == 0
) => 
    j +                 // our current j counter
    ' bottle' +
    (j > 1 ? 's' : _) + // choose 's' when we have more than 1 bottle, or blank _
    (
        (j % 3 ? _ : 'fizz') +      // if j % 3 is 0, add 'fizz', otherwise blank _
        (j % 5 ? _ = '' : 'buzz')   // if j % 5 is 0, add 'buzz', otherwise blank _
                                    // _ gets defined here since it's the first place it's used
            ||                      // if no fizz or buzz, result is a falsey empty string
        'beer'                      // replace falsey value with 'beer'
    ) +
    o                               // append o

while (i) {         // while counter is non-zero
    console.log(    // output string:
        z() +       // call z without o argument
        ', ' +
        z(_) +      // call z with blank _ for o to block ' on the wall' here
        '.\n' +
        ( --i       // decrement i, if still non-zero:
            ? 'Take one down and pass it around'
                    // otherwise:
            : 'Go to the store and buy some more'
        ) + 
        ', ' +
        z() +       // another call to z without o
        '.\n\n'
    )
}

JavaScript (ES6), 316 309 bytes

This is a full program rather than a function. Nothing very creative, it's just the naive approach (hence the bytecount!). I am using console.log() instead of alert() because many browsers have limit on the number of chars that can be displayed using alert(). Note that all the whitespaces and newlines are necessary.

a="";for(i=99;i>0;i--){b=j=>"bottle"+(j>1?"s":"");d=a=>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer");w=" on the wall";o=" of ";a+=`${i+" "+b(i)+o+d(i)+w+", "+i+" "+b(i)+o+d(i)}.
${i>1?"Take one down and pass it around, ":"Go to the store and buy some more, "}${(y=i-1?i-1:99)+" "+b(y)+o+d(y)+w}.

`;}console.log(a)

Ungolfed :

let accumulator = "";
for(let i = 99; i>0; i--){
    let bottleString = j => "bottle"+(j>1?"s":""),
    drink = a =>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer",
    wallString = " on the wall",
    of=" of ";
    accumulator += `${i+" "+bottleString(i)+of+drink(i)+wallString+", "+i+" "+bottleString(i)+of+drink(i)}.
${i>1?"Take one down and pass it around, ":"Go to the store and buy some more, "}${(y=i-1?i-1:99)+" "+bottleString(y)+of+drink(y)+wallString}.

`;
}

console.log(accumulator);

Here's the Snippet :

a="";for(i=99;i>0;i--){b=j=>"bottle"+(j>1?"s":"");d=a=>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer";w=" on the wall";o=" of ";a+=`${i+" "+b(i)+o+d(i)+w+", "+i+" "+b(i)+o+d(i)}.
${i>1?"Take one down and pass it around, ":"Go to the store and buy some more, "}${(y=i-1?i-1:99)+" "+b(y)+o+d(y)+w}.

`;}console.log(a)

BTW, with this answer, I have earned the bronze badge in ! Never thought I will accomplish this ever (not that it's a big achievement, though.)!

C (GCC), 276 274 bytes

Thanks to Neil for saving two bytes!

#define w" on the wall"
#define c(i)printf("%d bottle%s of %s",i,"s"+!~-i,i%3?i%5?"beer":"buzz":i%5?"fizz":"fizzbuzz"),printf(
i;f(){for(i=99;i;c((i?:99))w".\n\n"))c(i)w", "),c(i)".\n"),printf(--i?"Take one down and pass it around, ":"Go to the store and buy some more, ");}

Who doesn't love unmatched parentheses in macro expansions ?

Ungolfed:

#define c(i)                               \
    printf(                                \
        "%d bottle%s of %s",               \
        i,                   /* Number  */ \
        i-1 ? "s" : "",      /* Plural  */ \
        i % 3                /* FizzBuzz*/ \
            ? i % 5                        \
                ? "beer"                   \
                : "buzz"                   \
            : i % 5                        \
                ? "fizz"                   \
                : "fizzbuzz"               \
    )

i;
f() {
    for(i = 99; i; ) {
        c(i); printf(" on the wall, ");
        c(i); printf(".\n");
        printf(
            --i
                ? "Take one down and pass it around, "
                : "Go to the store and buy some more, "
        );

        // This has been stuffed into the for increment
        c((i?:99)); printf(" on the wall.\n\n");
    }
}

See it live on Coliru!

Alternate version (276 bytes)

#define c(i)printf("%d bottle%s of %s",i,i-1?"s":"",i%3?i%5?"beer":"buzz":i%5?"fizz":"fizzbuzz"),printf(
i,*w=" on the wall";f(){for(i=99;i;c((i?:99))"%s.\n\n",w))c(i)"%s, ",w),c(i)".\n"),printf(--i?"Take one down and pass it around, ":"Go to the store and buy some more, ");}

Java, 344 340 339 bytes

(-4 bytes after golfing fizzbuzz; -1 byte removing stray whitespace)

interface X{static void main(String[]a){for(int i=99;i>0;System.out.printf("%s on the wall, %s.%n%s, %s on the wall.%n%n",b(i),b(i--),i<1?"Go to the store and buy some more":"Take one down and pass it around",b(i<1?99:i)));}static String b(int i){return i+" bottle"+(i>1?"s":"")+" of "+(i%3<1?"fizz":"")+(i%5<1?"buzz":i%3<1?"":"beer");}}

Slightly ungolfed (using 1-space indentation to eliminate horizontal scrolling):

interface X {
 static void main(String[]a){
  for(int i=99;i>0;System.out.printf("%s on the wall, %s.%n%s, %s on the wall.%n%n",
   b(i),b(i--),
   i<1?"Go to the store and buy some more":"Take one down and pass it around",
   b(i<1?99:i)));
 }
 static String b(int i){
  return i+" bottle"+(i>1?"s":"")+" of "+(i%3<1?"fizz":"")+(i%5<1?"buzz":i%3<1?"":"beer");
 }
}

PHP, 242 Bytes

function f($k){return"$k bottle".(s[$k<2])." of ".([fizz][$k%3].[buzz][$k%5]?:beer);}$w=" on the wall";for($b=f($c=99);$c;)echo"$b$w, $b.
",--$c?"Take one down and pass it around":"Go to the store and buy some more",", ",$b=f($c?:99),"$w.

";

Try it online!

PHP, 244 Bytes

for($e=s,$b=fizz,$c=99;$c;)echo strtr("301245, 30124.
6, 708295.

",[" bottle",$e," of ",$c,$b," on the wall",--$c?"Take one down and pass it around":"Go to the store and buy some more",$k=$c?:99,$e=s[2>$k],$b=[fizz][$k%3].[buzz][$k%5]?:beer]);

Try it online!

use function strtr

PHP, 245 Bytes

$f=function($k)use(&$b){$b="$k bottle".(s[$k<2])." of ".([fizz][$k%3].[buzz][$k%5]?:beer);};for($w=" on the wall",$f($c=99);$c;)echo"$b$w, $b.
",--$c?"Take one down and pass it around":"Go to the store and buy some more",", {$f($c?:99)}$b$w.

";

Try it online!

use an Anonymous function in the string to get a sustring depending of the integer

Expanded

$f=function($k)use(&$b){$b="$k bottle".(s[$k<2])." of ".([fizz][$k%3].[buzz][$k%5]?:beer);};
for($w=" on the wall",$f($c=99);$c;)
echo"$b$w, $b.
",--$c?"Take one down and pass it around":"Go to the store and buy some more"
,", {$f($c?:99)}$b$w.

";

C, 349 345 344 bytes

#define b(x)x^1?" bottles":" bottle"
#define g i-1?"Take one down and pass it around":"Go to the store and buy some more"
*w=" on the wall";*s(x){return x?x%15?x%5?x%3?"beer":"fizz":"buzz":"fizzbuzz":"fizz";}i=100;main(){while(--i){printf("%d%s of %s%s, %d%s of %s.\n%s, %d%s of %s%s.\n",i,b(i),s(i),w,i,b(i),s(i),g,i-1?i-1:99,b(i-1),s(i-1),w);}}

Well, there you go. That took an hour.

Try it online!

SOGL, 136 135 134 133 131 bytes

Ƨ, o▓k
"πFT+╔¡‘oW
³³q"'bμ⁸‘oH? so}5\;3\«+"ΞQv↑χāσκN⌡κYT¡‘_,S─‘oθwoX▓
MH∫}¹±{▓WkƧ.¶oH¡"sΗ─χpēGķ¶¾3Ζ^9f.⅟▒E┌Fρ_╬a→‘KΘw⁽oXH‽M}HkW">⁸‘p

First of all, the 3rd function:

                                    ▓  name this "▓" (example input: 15)                          [15]
³³                                     Create 4 extra copies of the top thing (number of things)  [15, 15, 15, 15, 15]
  q                                    output without popping one of them                         [15, 15, 15, 15, 15]
   "...‘o                              output " bottle"                                           [15, 15, 15, 15, 15]
         H?   }                        if pop-1 [isn't 0]                                         [15, 15, 15, 15]
            so                           output "s"                                               [15, 15, 15, 15]
               5\                      push if POP divides by 5                                   [15, 15, 15, 1]
                 ;                     swap [if divides & another number copy]                    [15, 15, 1, 15]
                  3\«                  push if POP divides by 3, multiplied by 2                  [15, 15, 1, 2]
                     +                 add those together                                         [15, 15, 3]
                      "...‘            push "buzz fizz fizzbuzz beer"                             [15, 15, 3, "buzz fizz fizzbuzz beer"]
                           ...‘o       output " of " (done over here to save a byte for a quote)  [15, 15, 3, "buzz fizz fizzbuzz beer"]
                                θ      split ["buzz fizz fizzbuzz beer"] on spaces                [15, 15, 3, ["buzz","fizz","fizzbuzz","beer"]]
                                 w     get the index (1-indexed, wrapping)                        [15, 15, ["buzz","fizz","fizzbuzz","beer"], "fizzbuzz"]
                                  o    output that string                                         [15, 15, ["buzz","fizz","fizzbuzz","beer"]]
                                   X   pop the array off of the stack                             [15, 15]

The first function:

Ƨ, o▓k
     k  name this "function" "k"
Ƨ, o    output ", "
    ▓   execute the "bottleify" function

The second function:

"πFT+╔¡‘oW
         W  call this "W"
"πFT+╔¡‘    push " on the wall"
        o   output it

And the main part:

MH∫}                                     repeat 99 times, each time pushing index
    ¹                                    wrap in an array
     ±                                   reverse it
      {                                  iterate over it
       ▓                                 execute that function
        W                                execute that function
         k                               execute that function
          Ƨ.¶o                           output ".\n"
              H¡                         push if POP-1 isn't 0 (aka 1 if pop <> 1, 0 if pop == 1)
                "...‘                    push "Stake one down and pass it aroundSgo to the store and buy some more"
                     K                   push the first letter of that string
                      Θ                  split ["take one down and pass it aroundSgo to the store and buy some more" with "S"]
                       w                 gets the xth (1-indexed, wrapping) item of that array
                        ⁽o               uppercase the 1st letter and output
                          X              pop the array off
                           H‽            if pop-1 [isn't 0]
                             M           push 100
                              }          ENDIF
                               H         decrease POP
                                k        execute that function
                                 W       execute that function
                                  ">⁸‘p  output ".\n\n"

Lost a couple bytes because of a bug that O puts a newline before and after it (And somehow this goes back to V0.9 (this is V0.11 code))

sed, 468 459 456 bytes

s:^:99 bottles of fizz on the wall, 99 bottles of fizz.:
p
s:99:I8:g
s:fizz:XYYZ:g
x
s:^:Take one down and pass it around, I8 bottles of XYYZ on the wall.\n:
G
x
:
g
s:XXX:fizz:g
s:Y{5}:buzz:g
s:\bX*Y*Z:beer:g
s:[XYZ]::g
y:ABCDEFGHI:123456789:
s:\b0::g
/ 1 /bq
p
x
s:^::
tc
:c
s:(\S)0:\1@:g
Td
y:ABCDEFGHI:0ABCDEFGH:
:d
y:123456789@:0123456789:
s:(XXX)*(Y{5})*(Y*Z):XY\3:g
x
b
:q
s:es:e:g
aGo to the store and buy some more, 99 bottles of fizz on the wall.

Try it online!

Requires -r flag.

Explanation

Hold space holds the pattern of two repeating lines, with numbers represented as [A-I][0-9] (separate digits for tens and ones) and the kind of beverage represented as X*Y*Z, where X keeps track of -N mod 3, and Y of -N mod 5.

On each subsequent iteration, the numbers get decremented and the Xs and Ys get updated. Then hold space gets copied to the pattern space, turned into lines of the song, and printed.

Retina, 230 bytes


99$*_
_\B
Take one down and pass it around, $.'#.¶¶$.'#, $.'.¶
^
99#, 99.¶
_
Go to the store and buy some more, 99#.
#
 on the wall
1\b|(\d+)
$& bottle$#1$*s of $&$*_
\b(_{15})+\b
fizzbuzz
\b(_{5})+\b
buzz
\b(___)+\b
fizz
_+
beer

Try it online! Explanation:


99$*_

Inserts 99 _s.

_\B
Take one down and pass it around, $.'#.¶¶$.'#, $.'.¶

Changes all but the last _ to the string Take one down and pass it around, $.'#.¶¶$.'#, $.'.¶, where is a newline and $.' is the count of remaining underscores. This effectively counts back from 98 to 1.

^
99#, 99.¶

Adds the first line of the first verse in "compact" format.

_
Go to the store and buy some more, 99#.

Adds the second line of the last verse. Why I need jump through hoops to use the _ I don't know, but $ seems to match twice, so I can't use that. Go figure.

#
 on the wall

Substitutes a string which appears several times in the verse.

1\b|(\d+)
$& bottle$#1$*s of $&$*_

This matches the integers in the verses, and suffixes the appropriate bottle(s) of, and expands back to unary again, in preparation to choose the beverage. (I save 1 byte on on the 99s this way.)

\b(_{15})+\b
fizzbuzz
\b(_{5})+\b
buzz
\b(___)+\b
fizz
_+
beer

Replace exact multiples with the appropriate beverage.

Python 2, 263 253 245 bytes

i=99
x=''
while i:x+=', %s on the wall.\n\n%s on the wall, %s.\n'%(('%d bottle%s of %s'%(i,'s'*(i>1),(i%3<1)*'fizz'+(i%5<1)*'buzz'or'beer'),)*3)+'GToa kteo  otnhee  dsotwonr ea nadn dp absusy  isto maer omuonrde'[i>1::2];i-=1
print x[35:]+x[:33]

Try it online!

05AB1E, 151 146 143 bytes

99LRv'¬ž“fizzÒÖ“#y35SÖÏJ‚˜1(è©y“ƒ¶€µ„‹€ƒî倕…¡, ÿÏꀂ ÿ€‰€€íÒ.“ªõ®y“ÿÏꀂ ÿ€‰€€íÒ, “D#4£ðýs…ÿÿ.}‚‚˜'Ïê'±¥:`)¦¦¬#7£ðý¨“‚œ€„€€ƒï€ƒ‚¥€ä€£, ÿ.“ª)˜»

Try it online!

Röda, 273 bytes

f{a=`bottle`f=` on the wall`g=`99 ${a}s of fizz`;[`$g$f, $g.
`];seq 98,1|{|b|d=`s`d=``if[b=1];c=``c=`fizz`if[b%3=0];c.=`buzz`if[b%5=0];c=`beer`if[c=``];e=`$b $a$d of $c`;[`Take one down and pass it around, $e$f.

$e$f, $e.
`]}_;[`Go to the store and buy some more, $g$f.`]}

Try it online!

Will golf further in the morning.