RosettaCodeData/Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-2.ocaml
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

9 lines
224 B
Text

let () =
while true do
print_string "Expression: ";
let str = read_line() in
if str = "q" then exit 0;
let expr = read_expression str in
let res = eval expr in
Printf.printf " = %g\n%!" res;
done