Sha256: edf9c2ce5df03f64c10d2dbf699df824582402c38da24c976f91bacfa41ee5ef

Contents?: true

Size: 523 Bytes

Versions: 311

Compression:

Stored size: 523 Bytes

Contents

# If the number has 3 as a factor, output 'Pling'.
# If the number has 5 as a factor, output 'Plang'.
# If the number has 7 as a factor, output 'Plong'.
# If the number does not have 3, 5, or 7 as a factor, just pass the number's digits straight through.

function raindrops(number::Int)
    drops = []
    number % 3 == 0 && push!(drops, "Pling")
    number % 5 == 0 && push!(drops, "Plang")
    number % 7 == 0 && push!(drops, "Plong")
    if size(drops, 1) == 0
      repr(number)
    else
      join(drops)
    end
end

Version data entries

311 entries across 311 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.179 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.178 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.177 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.176 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.175 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.174 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.173 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.172 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.171 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.170 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.169 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.167 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.166 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.165 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.164 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.163 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.162 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.161 tracks/julia/exercises/raindrops/example.jl
trackler-2.2.1.160 tracks/julia/exercises/raindrops/example.jl