Thanks , it's working now like this :

loop :: Int -> IO ()
loop n = do
    if n <= 100
    then do
        putStrLn (show n );
        putChar ' ';
        putStrLn (show (n * n )) ;
        loop (n + 1);
    else
       return () ;

main :: IO ()
main = loop 1

But the outcome looks like this:

1
   1
2
   4

Can I somehow make it like this 

1   1
2    4
3    9

Roelof



Taylor Hedberg schreef op 10-5-2014 17:45:
On Sat, May 10, 2014 at 8:22 AM, Roelof Wobben <r.wobben@home.nl> wrote:
Is it valid Haskell if I change the putStrln to putStrln ( show n * n) so I do not have to use the let command.

You would need to write putStrLn (show (n * n)) in order for it to parse the way you intend. Function application is left-associative. You could also use print instead of putStrLn, which is shorthand for this.

Another question if I change return n with return () does the loop ever end.  My feeling says not because the value of n is never updated for the loop.

Yes, the loop would terminate. The return n in your code is not updating n. The next iteration of the loop receives a new value of n as its argument due to your passing it in with loop (n + 1).