小编Has*_*oob的帖子

Haskell - 做循环

我是Haskell的新手,如果有人愿意帮助我,我会很高兴的!我试图让这个程序与do while循环一起工作.

第二个getLine命令的结果被放入varible goGlenn,如果goGlenn不等于"start",那么程序将返回到开头

    start = do
    loop $ do lift performAction
        putStrLn "Hello, what is your name?"
        name <- getLine
        putStrLn ("Welcome to our personality test " ++ name ++ ", inspired by the Big Five Theory.") 
        putStrLn "You will receive fifty questions in total to which you can reply with Yes or No."
        putStrLn "Whenever you feel ready to begin please write Start"
        goGlenn <- getLine
        putStrLn goGlenn
    while (goGlenn /= "start")
Run Code Online (Sandbox Code Playgroud)

haskell while-loop do-while

5
推荐指数
1
解决办法
6389
查看次数

标签 统计

do-while ×1

haskell ×1

while-loop ×1