DEV Community

loading...

Discussion on: Daily Challenge #61 - Evolution Rate

Collapse
craigmc08 profile image
Craig McIlwrath

Haskell:

getEvolutionRateMessage :: Double -> Double -> String
getEvolutionRateMessage before after
  | evol > 0  = "A positive evolution of " ++ show evol ++ "%."
  | evol == 0 = "No evolution."
  | evol < 0  = "A negative evolution of " ++ show (0-evol) ++ "%." 
  where evol = (after - before) / before * 100
Collapse
aminnairi profile image
Amin

I long awaited this one. Haha!