Printing a value in a reasonML program


I’ve used various sites’ suggestions to make a basic-reason project, and the only Reason file is, which contained the line

Js.log(“Hello, BuckleScript and Reason!”);

Within VSCode, using the vscode-reason plugin, I can compile this to javascript, and (via a terminal within VSCode) do

% Node src/

and get, as output, “Hello, Bucklescript and Reason!”

which is very satisfying. But I also have a bunch of OCaml code that I’d like to convert to Reason, and it uses things like “print_int” and “print_string”. if I add to my to make it

Js.log("Hello, BuckleScript and Reason!");

and then run that…I get exactly the same output – the “4” doesn’t appear anywhere I can find. Are print_int and its ilk deprecated? Do their outputs go somewhere other than the shell?

Any help/explanaations appreciated here.


print_int doesn’t flush the output buffer with neither BuckleScript or native. Try adding a print_newline() afterwards.


You’re my new hero. :slight_smile:
Thanks very much!