Difference between revisions of "Cookbook/Interactivity"

From HaskellWiki
Jump to navigation Jump to search
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
== Input and output ==
  +
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 12: Line 14:
 
</haskell>
 
</haskell>
 
|-
 
|-
| printing a string in a new line
+
| printing a string with a newline character
 
| [http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AputStrLn putStrLn]
 
| [http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AputStrLn putStrLn]
 
|<haskell>
 
|<haskell>
 
Prelude> putStrLn "Foo"
 
Prelude> putStrLn "Foo"
 
Foo
 
Foo
  +
Prelude>
 
</haskell>
 
</haskell>
 
|-
 
|-

Revision as of 09:08, 2 August 2009

Input and output

Problem Solution Examples
printing a string putStr
Prelude> putStr "Foo"
FooPrelude>
printing a string with a newline character putStrLn
Prelude> putStrLn "Foo"
Foo
Prelude>
reading a string getLine
Prelude> getLine
Foo bar baz          --> "Foo bar baz"


Parsing command line arguments

TODO