Sha256: 7bfb8bdfef2bff22eac94df49e16bf8346a834bb9e0fc11f74961a6480ce0d9b
Contents?: true
Size: 311 Bytes
Versions: 37
Compression:
Stored size: 311 Bytes
Contents
class Raindrops { private val sounds = List((3, "Pling"), (5, "Plang"), (7, "Plong")) def convert(n: Int): String = sounds.filter{case (m, _) => n % m == 0}.map{case (_, s) => s}.mkString match { case "" => n.toString case s => s } } object Raindrops { def apply() = new Raindrops }
Version data entries
37 entries across 37 versions & 1 rubygems