必要な入力は、取得する等級番号だけです。これはこれまで私が持っていたものです。Haskellのifステートメントの正しい構文
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")
をが、それはどちらか動作しませんでした:
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"
これは私にエラー「「場合は `入力にエラーを解析」を与える、私も試してみました。
場合は、「F」を獲得するために論理的な誤りを訂正します。 –
ネストされた 'if'の代わりにここでガードを使う方が良いでしょう。 – hammar