Is it possible to put print statements for debugging/testing in blocks of code?
For example, in Java you can use System.out.println("") in the middle of methods to check variables or other things.
But in OCaml, would a command like print_string work? Wouldn’t it return a value of type unit, thus causing an error, instead of allowing you to print it?
You will be fine if you embed the print in an expression sequence.
UPDATE
Here is a concrete example, because the answer above was rather short and, well, answers with links only are not good answers. It is the classic tail-recursive formulation of factorial (yeah, boring, but familiar):
Here you can see the side-effects of the print, but the result still turned out to be 120 as expected.