DEV Community

Discussion on: Daily Challenge #247 - Get Planet Name By ID

Collapse
 
aminnairi profile image
Amin • Edited

Because the interpreter is not helpful.

Try Elm, the compiler is nice.

type Planet
    = Mercury
    | Venus
    | Earth
    | Mars
    | Jupiter
    | Saturn
    | Uranus
    | Neptune


getPlanetName : Planet -> String
getPlanetName planet =
    case planet of
        Mercury -> "Mercury"
        Venus   -> "Venus"
        Earth   -> "Earth"
        Mars    -> "Mars"
        Jupiter -> "Jupiter"
        Saturn  -> "Saturn"
        Uranus  -> "Uranus"
        Neptune -> "Neptune"

Note: Does not respond to the challenge at all