I would like to print each integer in a list.
I can do this with List.iter like so:
digits|> List.iter (fun i -> print_int i; print_newline ())However, I generally prefer to keep imperative code outside of pipelines of functions.
Is it possible to write this in a for-each loop in OCaml?
(Hypothetical syntax)
for i in digits do print_int i ; print_newline ()end