
10 May
2014
10 May
'14
11:54 a.m.
On 05/10/2014 05:53 PM, Roelof Wobben wrote:
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
Take a look at the `putStr' function. It omits the newline character that putStrLn writes at the end of the string. Jochem -- Jochem Berndsen | jochem@functor.nl