langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
9
Task/Menu/OCaml/menu.ocaml
Normal file
9
Task/Menu/OCaml/menu.ocaml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
let rec select choices prompt = (* "choices" is an array of strings *)
|
||||
if Array.length choices = 0 then invalid_arg "no choices";
|
||||
Array.iteri (Printf.printf "%d: %s\n") choices;
|
||||
print_string prompt;
|
||||
let index = read_int () in
|
||||
if index >= 0 && index < Array.length choices then
|
||||
choices.(index)
|
||||
else
|
||||
select choices prompt
|
||||
Loading…
Add table
Add a link
Reference in a new issue