我想寫一個簡單的函數,它接受三個Int值並返回這三個中最小和最大整數之和。Haskell中的表達式中的語法錯誤(意外的'}')
我的代碼:
summinmax3 :: Int -> Int -> Int -> Int
summinmax3 x y z =
if (x > y && z < y)
then (x + z)
else if (y > x && z < x)
then (y + x)
else if (z > x && y < X)
then (y + z)
的代碼返回錯誤syntax error in expression (unexpected '}'), possibly due to bad layout
任何幫助,將不勝感激
你使用哪種編譯器/解釋器?這就是說,每個'then'都需要一個'else'。另外,Haskell區分大小寫。 – Zeta