and was curious to see what its output was…but I was only able to see it on the command line. So I was curious whats going on. Perhaps my error/weird question stems from me also not knowing what unit is.
Ah. Perhaps what you’re looking for, is the type of 3 > 1 ?? It would be bool. The compiler is telling you that in a semicolon-sequence (viz. A ; B) the expression A does not have type unit, hence perhaps you (the programmer) didn’t mean to be computing and then discarding the result of A.
Unit is a type with a single value: ().
One could write a printer for unit as:
let string_of_unit () = "()"
But then since a value of term unit is necessarily a constant (), it is possible to simply remove the argument
let string_of_unit = "()"
And it is a general rule with unit: a value of type unit does not contain any information. So when a function returns unit, it is telling you that it does not return any meaningful information. In particular, it is a sign that the function is effectful: a pure function that only returns unit could be directly replaced by unit.
For instance, the type of print_string: string -> unit is literally telling us that print_string takes a string as an argument, and then does not return any information to the caller. The implication here is that print_string is doing an effect with its string argument, specifically printing it.