Introduction . It seems to me useful to first discuss the difference in a simple example, as this helps to understand what a "unit" is. The first declaration creates a string value (and immediately calls ReadLine to get input from the user):
> let readLine = Console.ReadLine ();; val readLine : string
The second declaration creates a function that takes the value of one as an argument. The function does not require input of any input, but we want to define it as a function so that it can be executed multiple times (we need it because the function has a side effect - it reads input from the user).
The "unit" parameter is just a way to create a function that takes something as an argument. "Unit" has only one value, written as () , therefore it does not represent any information - only the fact that there is some parameter:
> let readLine () = Console.ReadLine ();; val readLine : unit -> string
Your question. . Look at your example with extra curly braces. This creates a function that takes the string as the first parameter and takes the additional value "unit" as the second parameter. You can see this from a signature like:
> let print (text : string) () = Console.WriteLine text val print : string -> unit -> unit
This is a valid F # declaration, but it is not very useful. This means that the function will be called only when you give it a line to print, as well as the additional value of "one." You can call it like this:
print "Hello" ()
Even without the additional parameter βunitβ, it will be a function (as opposed to a value), so adding an additional parameter does not help (you always create a function that can be called to print different lines).
There are still cases where this declaration may be interesting. For example, you can only call a function with a string as a parameter. In this case, you will get the function as the result. The returned function will take a block and print a line:
let f = print "Hello"
Thus, the compiler allows you to use the values ββof "units" like any other values ββin the language. This includes usage, which may seem a little unfamiliar (and not very useful) at the beginning, but may make sense in some kind of scenario.