mirror of
https://github.com/correl/elm.git
synced 2024-11-25 11:09:53 +00:00
30 lines
578 B
Elm
30 lines
578 B
Elm
module Raindrops exposing (..)
|
|
|
|
import String
|
|
|
|
|
|
raindrops : Int -> String
|
|
raindrops number =
|
|
let
|
|
drops =
|
|
[ if number % 3 == 0 then
|
|
"Pling"
|
|
else
|
|
""
|
|
, if number % 5 == 0 then
|
|
"Plang"
|
|
else
|
|
""
|
|
, if number % 7 == 0 then
|
|
"Plong"
|
|
else
|
|
""
|
|
]
|
|
|
|
result =
|
|
String.join "" drops
|
|
in
|
|
if result == "" then
|
|
toString number
|
|
else
|
|
result
|