Reputation: 71
When I use this code it's print newline after result. How I can don't write newline?
import System.IO
main :: IO ()
main = do
a <- getLine
b <- getLine
let aa = read a :: Int
let bb = read b :: Int
let cc = aa + bb
print cc
Upvotes: 7
Views: 7065
Reputation: 1050
You can also putStr
instead of putStrLn.
Not sure how you would do something similar with print
though.
Upvotes: 0
Reputation: 102216
print
is defined as putStrLn . show
, the fix is to use putStr . show $ cc
.
Upvotes: 22