Haskell provides putChar function, which
writes a character to standard output.
Prelude> :t putChar
putChar :: Char -> IO ()
Sample.hs
main = do putStrLn "Enter (M) If you are male, else (F) " gender <- getChar putChar gender
$ ghc Sample.hs Linking Sample ... $ ./Sample Enter (M) If you are male, else (F) M M
No comments:
Post a Comment