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.65 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.64 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.63 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.62 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.61 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.60 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.59 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.58 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.57 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.56 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.55 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.54 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.53 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.52 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.51 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.50 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.49 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.48 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.47 tracks/scala/exercises/beer-song/example.scala
trackler-2.2.1.46 tracks/scala/exercises/beer-song/example.scala