i read the definition of void type in wikipedia, also the definition of unit type:
A function with void result type ends either by reaching the end of the function or by executing a return statement with no returned value. The void type may also appear as the sole argument of a function prototype to indicate that the function takes no arguments. Note that despite the name, in all of these situations, the void type serves as a unit type, not as a zero or bottom type, even though unlike a real unit type which is a singleton, the void type is said to comprise an empty set of values, and the language does not provide any way to declare an object or represent a value with type void.
In the area of mathematical logic, and computer science known as type theory, a unit type is a type that allows only one value (and thus can hold no information)
following this both examples make no sense
you are returning no information so why using return foo(); ?