In python, I can ask a question to a user in using
response = input("What is your name?")
print(response)
How can I do such thing using Ocaml? I think I can
use read_line
, but I am not sure how to do it equivalently.
This will work:
print_string "What is your name? ";
flush stdout;
let response = read_line () in
print_endline response