I would like to understand which is the difference between these two programming concepts. The first represents the absence of data type and at the latter the type exists bu
The unit type just makes everything more regular. To an extent you can think of every function in F# as taking a single parameter and returning a single result. Functions that don't need any parameters actually take "unit" as a parameter, and functions that don't return any results return "unit" as a result. This has a variety of advantages; for one, consider how in C# you need both a slew of "Func" delegates to represent functions of various arities that return values, as well as a slew of "Action" delegates that do not return values (because e.g. Func
is not legal - void cannot be used that way, since it's not quite a 'real' type).
See also F# function types: fun with tuples and currying