diff --git a/message-index/messages/GHC-01239/index.md b/message-index/messages/GHC-01239/index.md index a8a254bc..d18978ab 100644 --- a/message-index/messages/GHC-01239/index.md +++ b/message-index/messages/GHC-01239/index.md @@ -8,11 +8,13 @@ introduced: 9.6.1 Unlike in many other languages, in Haskell the If-Then-Else construct is an expression, which means it returns a value that can be processed further. ```haskell -ageMessage :: Int -> String -ageMessage age = if age < 18 then "You are too young to enter" else "Welcome to the club" +greetUser :: Int -> IO () +greetUser age = putStrLn (if age < 18 + then "You are too young to enter" + else "Welcome to the club") -putStrLn (ageMessage 10) -- You are too young to enter -putStrLn (ageMessage 20) -- Welcome to the club +greetUser 10 -- You are too young to enter +greetUser 20 -- Welcome to the club ``` Because If-Then-Else expressions return values, it makes sense to pass them as input to a function.