Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-
- -- Example 1
- main :: IO ()
- main = do
- putStr "Please enter your name: "
- name <- getLine
- putStrLn ("Hello, " ++ name ++ ", how are you?")
- -}
- {-
- -- Example 2
- import Data.Char
- main :: IO ()
- main = do{
- putStr "Enter a word: ";
- word <- getLine;
- if (isPalindrome word)
- then putStrLn ("\"" ++ word ++ "\" is palindrome!")
- else putStrLn ("\"" ++ word ++ "\" is not palindrome!") }
- isPalindrome :: String -> Bool
- isPalindrome w = (ys == (reverse ys))
- where ys = map toLower (filter isAlpha w)
- -}
- {-
- -- Example 3
- main :: IO ()
- main = do
- putStrLn "What is 2 + 2? "
- x <- readLn
- if x == 4
- then putStrLn "You are right"
- else putStrLn "You are wrong"
- -}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement