Sha256: 8d4b944b8c8a634ddee7b64d0a0cc1dd854affa0cdfa2c2789bebdc15a25bf16

Contents?: true

Size: 721 Bytes

Versions: 149

Compression:

Stored size: 721 Bytes

Contents

object Example {
  def verses(upper: Int, lower: Int): String =
    upper to lower by -1 map verse mkString "\n"

  def verse(n: Int): String = n match {
    case 0 => "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"
    case 1 => "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"
    case 2 => "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"
    case _ => s"$n bottles of beer on the wall, $n bottles of beer.\nTake one down and pass it around, ${n - 1} bottles of beer on the wall.\n"
  }
}

Version data entries

149 entries across 149 versions & 1 rubygems

Version Path
trackler-2.2.1.105 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.104 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.103 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.102 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.101 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.100 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.99 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.98 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.97 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.96 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.95 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.94 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.93 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.92 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.91 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.90 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.89 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.88 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.87 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.86 tracks/scala/exercises/beer-song/example.scala