I’m trying to make a simple function that gets 2 variables from the user (x,y)
makes a calculation, and prints it out.
for some reason without success:
main = do
putStrLn "Insert Number1"
x <- readLn
putStrLn "Insert Number2"
y <- readLn
z = (x * y * 0.01)
putStrLn "Result: " ++z
The Error I get:
test.hs:6:11: parse error on input `='
Use
letto bind new variables. You also have a few errors on the final line: first, you must explicitly convert betweenDoubleandString(using, for example,show), and secondly, you need to remember precedence. In Haskell, function application binds tighter than anything except record updates, so what you wrote parses as(putStrLn "Result: ") ++ z, which doesn’t really make sense. With these things fixed: