Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

22
Task/Menu/F-Sharp/menu.fs Normal file
View file

@ -0,0 +1,22 @@
open System
let rec menuChoice (options : string list) prompt =
if options = [] then ""
else
for i = 0 to options.Length - 1 do
printfn "%d. %s" (i + 1) options.[i]
printf "%s" prompt
let input = Int32.TryParse(Console.ReadLine())
match input with
| true, x when 1 <= x && x <= options.Length -> options.[x - 1]
| _, _ -> menuChoice options prompt
[<EntryPoint>]
let main _ =
let menuOptions = ["fee fie"; "huff and puff"; "mirror mirror"; "tick tock"]
let choice = menuChoice menuOptions "Choose one: "
printfn "You chose: %s" choice
0