DEV Community

loading...

Discussion on: Daily Challenge #56 - Coffee Shop

Collapse
aminnairi profile image
Amin

My take at the challenge written in Haskell this time!

changeToMessage :: Float -> String
changeToMessage change 
    | change == 2.2 = "Here is your Americano, have a nice day!"
    | change == 2.3 = "Here is your Late, have a nice day!"
    | change == 2.4 = "Here is your Flat White, have a nice day!"
    | change == 3.5 = "Here is your Filter, have a nice day!"
    | otherwise = "Sorry, exact change only, try again tomorrow!

Try it online.