Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的回答是:
如何在函数中声明 print?
bisiesto :: Int -> **?**; bisiesto x = if (x `mod` 4 == 0 && ((x `mod` 100 /= 0) || (x `mod` 400 == 0))) then print("Es bisiesto") else print("No es bisiesto");
请问,谁能帮帮我?谢谢。
这是一个简化版本(我改变了逻辑):
bisiesto :: Int -> IO () bisiesto n | even n = n : print "Es bisiesto" | otherwise = print "No es bisiesto"
像这样工作:
Prelude> bisiesto 2 "Es bisiesto"