Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you write in imperative style (using expressions for their side effect and discarding their return values) then you separate statements with a ;. But for code written in functional style, there will be no ;'s.

Then ;; is used to separate statements at the top level. But in most of the cases when a new top level statement begins, OCaml can understand this anyway and you can omit the ;;. Or use the ;; if you prefer that style.

So, imperative code is as full of ;'s as C code, and toplevel use of ;; is a stylistic issue.

https://ocaml.org/learn/tutorials/structure_of_ocaml_program...




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: