Mix of codes... 553

 Code:
function a($)
  Dim $W
  
  $ = 1 * $

  $W = ' on the wall'

  ; build the string
  ; Get the "x bottles of beer" phrase
  $a = W($)
  ; build it, and capitalize the first letter
  $a = UCase(Left($a, 1)) + Right($a, ~) + $W + ', ' + $a + '.'

  ; If $ isn't zero, take one down, otherwise go buy some more!
  If $
    $a = $a + ' Take one down and pass it around, ' + W($ - 1) + $W + '.'
  Else
    $a = $a + ' Go to the store and buy some more, ' + W(99) + $W + '.'

endfunction

Function W($)
    dim $b
    $b="no more",one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen,twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety
    if $<20
      $w=$b[$]
    else
      $w= $b[18+ $/10]	  
      if $ mod 10
        $w=$w + "-" + $b[$ mod 10] 
      endif
    endif     
    $W = $W + ' bottle' + IIf($ = 1, @, s) + ' of beer'

EndFunction