Skip to content

Instantly share code, notes, and snippets.

@lucian1900
Created October 14, 2015 16:15
Show Gist options
  • Save lucian1900/b52bf440f8234243837a to your computer and use it in GitHub Desktop.
Save lucian1900/b52bf440f8234243837a to your computer and use it in GitHub Desktop.
open System
let rec prompt convert msg =
printf msg
try
Console.ReadLine() |> convert
with _ -> prompt convert msg
let processPersonInfo() =
let name = prompt string "Name: "
let age = prompt int "Age: "
let kind = if age >= 20 then "no longer a teenager"
elif age < 20 && age > 13 then "teenager"
else "child"
printf "%s (%i) is a %s.%s" name age kind Environment.NewLine
[<EntryPoint>]
let main argv =
let n = prompt int "How many people? "
for i = 1 to n do
processPersonInfo()
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment