elm/exercises/raindrops/Raindrops.example

31 lines
462 B
Text
Raw Normal View History

module Raindrops exposing (..)
2016-03-13 20:20:01 +00:00
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
""
2016-03-13 20:20:01 +00:00
]
2016-03-13 20:20:01 +00:00
result =
String.join "" drops
in
if result == "" then
toString number
else
result