putStrLn / print
Try it yourself →Printing to the screen.
Syntax
putStrLn text // print value
Description
putStrLn writes a String and moves to the next line. print writes any value (number, items) (using show). main is the entry point of the program.
Example
main = do putStrLn "Hello" print 42
Expected output
Hello 42
When to use?
Showing results, debugging.
Common mistakes
- ⚠️ putStrLn only takes a String; use print or show for numbers.