Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- * edX course: Microsoft: DEV207.1x Programming in F#
- * Assignment: Module 2: Conditionals and Loops - Question 3
- * Author: jecxjo
- *)
- open System
- let rec info i =
- printfn "Person %d" i
- printf "Name: "
- let name = Console.ReadLine()
- printf "Age: "
- let b,age = Int32.TryParse(Console.ReadLine());
- if b && name.Length > 0 then
- if age >= 20 then
- printfn "%s is no longer a teenager" name
- elif age < 20 && age >= 13 then
- printfn "%s is a teenager" name
- else
- printfn "%s is a child" name
- else
- printfn "Error entering info"
- info i
- [<EntryPoint>]
- let main _ =
- printf "Enter number of people: "
- let b,count = Int32.TryParse(Console.ReadLine())
- if b then
- for i = 1 to count do
- info i
- else
- printf "Not a number"
- 0
Advertisement
Add Comment
Please, Sign In to add comment