【发布时间】:2018-03-27 23:39:18
【问题描述】:
我正在尝试编写一个函数来执行 2 种不同的游戏模式,这些模式被定义为 tictactoe :: IO () 和 main :: IO ()。我在输入“|”上遇到解析错误。我不明白我做错了什么。有人可以向我解释一下吗?
tictac :: IO()
tictac = do
putStrLn "Would you like to play against the computer or
another player? Enter: 2 Player or Computer"
choice <- getLine
|choice == "Computer" = main
|choice == "2 Player" = tictactoe
|otherwise = putStrLn "That's not a choice!"
【问题讨论】:
标签: haskell