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.85 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.84 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.83 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.82 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.81 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.80 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.79 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.78 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.77 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.76 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.75 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.74 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.73 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.72 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.71 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.70 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.69 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.68 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.67 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.66 tracks/scala/exercises/beer-song/example.scala