Here’s the main driver of the program:
open Helpers [EntryPoint] let main _ = let name = nameRetrieval() let ethnicity = ethnicityRetrieval() displayInfo name ethnicity exit()
Here’s the implementation details:
module Helpers open System let nameRetrieval() = Console.WriteLine("Enter your name\n\n") Console.ReadLine() let ethnicityRetrieval() = Console.WriteLine("\n\nEnter your ethnicity") Console.ReadLine() let startsWithVowel (word:string) = let isVowel (charater:char) = let value = charater.ToString().ToLower() match value with | "a" | "e" | "i" | "o" | "u" -> true | _ -> false word.Chars(0) |> isVowel let modifier (ethnicity:string) = if (ethnicity.Length >= 3 && ethnicity.Contains(" ") && ethnicity |> startsWithVowel) then "an " else "" let displayInfo name ethnicity = printfn "\n\nHello %s\n\nYou are %s%s" name (modifier ethnicity) ethnicity let exit() = let _ = Console.ReadKey() 0