[Haskell-beginners] Password Program Questions

David McBride toad3k at gmail.com
Thu Aug 3 23:39:04 UTC 2017


Remember that haskell is whitespace delimited.  You probably intended
putStrLn "Welcome" to line up with pw, in its own do.

if pass == "12345"
  then do
    putStrLn "welcome"
    pw
  else do
    putStrLn "wrong"
    main


On Thu, Aug 3, 2017 at 6:59 PM, Casey Newsome <casey_newsome98 at ymail.com> wrote:
> I am very new to Haskell and I am attempting to make a simple password
> program as my first program. I have ran into a problem and I am not very
> sure on how to fix it. I do not know how to make a second section for the
> passwords. My guessing attempts have failed so I am asking for help.
>
>
>
>
>
>
> Here is my code
>
> main = do
>       putStrLn "Hello, Who are you?"
>       name <- getLine --User Input
>       putStrLn ("Hey " ++ name ++ ", What's the password?")
>       pass <- getLine
>       if pass == "12345"
>           then putStrLn ("Welcome")
>           pw
>           else do
>               putStrLn "That is wrong!"
>               main
> pw = do
>     putStrLn "What Password do you need?"
>
>
>
>
>
>
> Thanks in advance, Casey :D
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>


More information about the Beginners mailing list