About the Reason compiler
OCaml syntax for JavaScript developers. Compiled online. Run Reason code in your browser with no install and no signup — the editor, the input and the output share one screen. Reason is executed by a remote runtime: your code is submitted to it and the output is returned to this page.
Press Run to execute the program, edit it and press Run again, or paste your own code over it. Everything you type stays in the page; the editor caches your work locally so a reload does not lose it.
A Reason example
This is the program the Reason editor opens with — run it as it is, then change it.
let scores = [92, 88, 95];
let total = Js.Array2.reduce(scores, (acc, x) => acc + x, 0);
let avg = Js.Int.toFloat(total) /. Js.Int.toFloat(Js.Array2.length(scores));
let grade = avg >= 90.0 ? "A" : avg >= 80.0 ? "B" : "C";
print_endline("Average: " ++ Js.Float.toString(avg) ++ " grade " ++ grade);
More Functional compilers
Browse all 109 languages — the same editor runs each of them, in the browser or on a shared runner.