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

Version Path
trackler-2.2.1.159 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.158 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.157 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.156 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.155 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.154 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.153 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.152 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.151 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.150 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.149 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.148 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.147 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.146 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.145 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.144 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.143 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.142 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.141 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.140 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift