-- Intermission: Exercises

-- We’re going to practice using case expressions by rewriting functions. Some
-- of these functions you’ve already seen in previous chapters (and some you’ll
-- see later using different syntax yet again!), but you’ll be writing new
-- versions now. Please note these are all written as they would be in source
-- code files, and we recommend you write your answers in source files and then
-- load into GHCi to check, rather than trying to do them directly into the
-- REPL.

-- First, rewrite if-then-else expressions into case expressions.

-- 1. The following should return x when x is greater than y.

functionC x y = case (x > y) of
                  True -> x
                  False -> y


-- 2. The following will add 2 to even numbers and otherwise simply return the
-- input value.
ifEvenA
functionC x y = case (x > y) of
                  True -> x
                  False -> y


-- 2. The following will add 2 to even numbers and otherwise simply return the
-- input value.
functionC x y = case (x > y) of
                  True -> x
                  False -> y


-- 2. The following will add 2 to even numbers and otherwise simply return the
-- input value.