The book Developing Applications with OCaml has the following explanation regarding return values:
When the value preceding the semicolon is discarded, the Objective CAML issues a warning if it is not of the unit type.
I donβt understand why it would be a problem if 2 has a return value other than unit , because my intention is not to return 2 , but to return 3 . The way I understand this, any instruction preceding my last statement is not the return value of a function, so why a warning?
I have this warning throughout my code, and it becomes clear to me that I really donβt understand how the returned values ββreally work in OCaml.
Thank you for your help.
ocaml return-value
GiantSquid
source share