From void to Unit

In some functional languagens all functions needs to return a value. For the cases when there aren't a value to returns is used the Unit type.

The unit type resembles the void type. But in this case, is possible to instance and creates values of Unit types.

It is a concrete type, you can create variables and returns Unit normally, but it has no data or behavior.

This type is specially useful to allow the cast between Action and Func delegates, besides that, it allows operations that can't create a value in a chainable composition.

Last updated