Why is the following code not correct ? i get this error: Last generator in do {…} must be an expression?
main = do putStrLn "What is 2 + 2?"
x <- readLn
if x == 4
then putStrLn "You're right!"
else putStrLn "You're wrong!"
You are mixing tabs and spaces: the second and fifth line contain tabs, while the third and fourth don’t.
The Haskell compiler probably expands tabs to a different number of spaces than your editor and what looks correctly indented in the editor looks messed up to the compiler.
Best avoid mixing tabs and spaces and only use one of them for indentation.