Sha256: 152b89374836b04f62db4d7bdbe146dbf2cd8dd39edf6739335dc262f75a7ab9

Contents?: true

Size: 781 Bytes

Versions: 77

Compression:

Stored size: 781 Bytes

Contents

defmodule BeerSong do
  def verse(1) do
    "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
  end

  def verse(2) do
    "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n"
  end

  def verse(3) do
    "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n"
  end

  def verse(number) do
    "#{number - 1} bottles of beer on the wall, #{number - 1} bottles of beer.\nTake one down and pass it around, #{number - 2} bottles of beer on the wall.\n"
  end

  def lyrics(range \\ 100..1) do
    range
      |> Enum.map(&verse/1)
      |> Enum.join("\n")
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
trackler-2.0.6.21 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.20 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.19 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.18 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.17 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.16 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.15 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.14 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.13 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.12 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.11 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.10 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.9 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.8 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.7 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.6 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.5 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.4 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.3 tracks/elixir/exercises/beer-song/example.exs
trackler-2.0.6.2 tracks/elixir/exercises/beer-song/example.exs