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.180 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.179 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.178 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.177 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.176 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.175 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.174 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.173 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.172 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.171 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.170 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.169 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.167 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.166 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.165 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.164 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.163 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.162 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.161 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift
trackler-2.2.1.160 tracks/swift/exercises/raindrops/Sources/RaindropsExample.swift