Nick Meyer wrote:
main = do putStrLn "Enter a number: "
         inp <- getLine
         let n = read inp
         if n == 0
         then putStrLn "Zero"
         else putStrLn "NotZero"

(that's with all the expressions in the do block lining up vertically, if
that doesn't show up in a fixed-width font), it works!  I would think that
your original indentation gave an error in that GHC would see "then" and
"else" and assume they were new expressions, but then I would expect that
this would have the same problem.  If anyone can shed some light on this,
that would be nice.

http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse
says "already implemented in GHC and Hugs".

Zun.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to