Sha256: e853cfec7dd58b653afff3f74c0a9584af43ad8e6e089b54df7973c78b7ee132
Contents?: true
Size: 650 Bytes
Versions: 396
Compression:
Stored size: 650 Bytes
Contents
struct Raindrops { private var drops: Int var sounds: String = "" private func convert(_ number: Int) -> String { let result = (number % 3, number % 5, number % 7) switch result { case (0, 0, 0):return "PlingPlangPlong" case (_, 0, 0):return "PlangPlong" case (0, _, 0):return "PlingPlong" case (0, 0, _):return "PlingPlang" case (_, _, 0):return "Plong" case (_, 0, _):return "Plang" case (0, _, _):return "Pling" default:return "\(number)" } } init(_ value: Int) { self.drops = value self.sounds = convert(value) } }
Version data entries
396 entries across 396 versions & 1 rubygems