[Haskell-cafe] Last statement in 'do' must be an expression error.

Szymon Ząbkiewicz zombek2 at gmail.com
Thu Aug 17 04:18:25 EDT 2006


Hi.

When trying to compilke this code:

{...}
 8.if (a == 0) && (b == 0)
 9.       then do
10.             nr1 <- read (prompt "enter 1. number: ")
11.             nr2 <- read (prompt "enter 2. number: ")
12.       else do
13.            let nr1 = a
14.                nr2 = b
{...}

The compiler tells me thats there's an error on line 10:
"The last statement in a 'do' construct mesy be an expression"

Could you tell me how to change it so that the "declaration" of the
first nr1 and nr2 is still in the "then" block.


More information about the Haskell-Cafe mailing list