I'm learning Ocaml and I need to create a program that can interact with the user in the following way:
Program: "Welcome!"
User: command1 arg1 arg2
program: "The answer is..."
User: command2 arg
program: "The answer is..."
User: exit
I need a scheme of the loop that make something like that
Here's a loop that will read lines of input until it reaches end of file, or sees a line that says "exit".
To call this loop in a source file, something like this will work:
To try it out in the toplevel (OCaml REPL):