Quantcast
Channel: DevDungeon - Haskell
Viewing all articles
Browse latest Browse all 6

Input, Output, and Concatenation with Haskell

$
0
0

Standard in and Standard out (STDIN/STDOUT) are very common methods of interacting with the user. Standard in is typically the keyboard and standard out is the terminal. Haskell makes this very easy to access. The getLine function gets a value from the user and putStrLn and putStr allow you to write to output. The ++ operator is used to concatenate strings.

main = do
     putStrLn "What is your name?"
     username <- getLine
     putStrLn $ "Hello, " ++ username ++ "!"

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images