L'unico input necessario è il numero del grado che si ottiene. Questo è quello che ho finora.Sintassi corretta per le istruzioni if in Haskell
myScore x = if x > 90
then let x = "You got a A"
if 80<x<90
then let x = "you got a B"
if 70<x<80
then let x = "You got a C"
if 60<x<90
then let x = "you got a D"
else let x = "You got a F"
Questo mi dà un errore "errore di analisi su input` se'", ho anche provato:
myScore x = (if x > 90 then "You got an A" | if 80 < x < 90 then "You got a B" | if 70 < x < 80 then "You got a D" | if 60 < x < 70 then "You got a D" else "You got a F")
, ma che non ha funzionato neanche.
È necessario aggiungere 'else' prima di ogni' if'. –
Sarebbe meglio usare guardie qui invece di 'if' nidificate. – hammar