getChar
functions reads a character from standard input device.
*Main> :t
getChar
getChar :: IO
Char
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