Sha256: b2cf45e5b37d5d22bf9881afcab608ba4fe80666d0425b6b092f2c22b1b6aa99

Contents?: true

Size: 865 Bytes

Versions: 396

Compression:

Stored size: 865 Bytes

Contents

##############
# Public API #
##############
verse = module.exports.verse = (num) ->
  switch num # Not breaking because of return.
    when 0 then """
    No more bottles of beer on the wall, no more bottles of beer.
    Go to the store and buy some more, 99 bottles of beer on the wall.
    """
    else """
    #{ bottles(num) } of beer on the wall, #{ bottles(num) } of beer.
    Take #{ one(num) } down and pass it around, #{ bottles(num - 1) } of beer on the wall.
    """

sing = module.exports.sing = (start, end = 0) ->
  (verse(num) + "\n" for num in [start..end]).join "\n"


###################
# Private Helpers #
###################
bottles = (num) ->
  switch num
    when 0 then "no more bottles"
    when 1 then "1 bottle"
    else "#{num} bottles"

one = (num) ->
  switch num # Not breaking because of return.
    when 1 then "it"
    else "one"

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.179 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.178 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.177 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.176 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.175 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.174 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.173 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.172 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.171 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.170 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.169 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.167 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.166 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.165 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.164 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.163 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.162 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.161 tracks/coffeescript/exercises/beer-song/example.coffee
trackler-2.2.1.160 tracks/coffeescript/exercises/beer-song/example.coffee